2

Well ,I sooooo flesh for the Golang . And I get a mission to recompile the Golang 's runtime via this blog.

One way is to change this default number in the GO runtime (GCC-GO or GC) and recompile the runtime. In proc.go, you can change the line sched.maxmcount = 10000 to a number that is appropriate.

First: recompile the whole golang.

I follow this Installing Go from source ,and execute this cmd:

./all.bash

Output is :

Building Go bootstrap tool.
cmd/dist
import cycle not allowed
package cmd/dist
    imports bytes
    imports errors
    imports runtime
    imports runtime/internal/atomic
    imports unsafe
    imports runtime

It seems everything work well, but while I check about the go cmd,it's the same. Also ,I can't find any change to bin or pkg dir.

Then ,try to build pkg

go install src/runtime

Also, it doesn't come out any error and I can't find any target build.

I have no any idea how to do it :(

Any suggestion well so appresiate !

6
  • 1
    all.bash is all you need to build all.
    – Volker
    Oct 21, 2016 at 9:21
  • Building will put the output in the first directory in your Go path + ./src/go/bin/go, this will need to be on your path in front of wherever your bootstrap Go install lives. It may also put the binaries in $GOBIN if set, IIRC.
    – user1087001
    Oct 21, 2016 at 14:23
  • @SamWhited: no it won't. Stdlib packages are special cased, and installed in GOROOT.
    – JimB
    Oct 21, 2016 at 17:19
  • @JimB if you have goroot set, but you really shouldn't: dave.cheney.net/2013/06/14/you-dont-need-to-set-goroot-really
    – user1087001
    Oct 21, 2016 at 17:54
  • 1
    @SamWhited: no, GOROOT is implied whether you set it or not (look at the output of go env GOROOT, and yes, you should not set it). You can see the see the output from my example (or use -x if you want everything), and check the timestamp on GOROOT/pkg/GOOS_GOARCH/runtime.a.
    – JimB
    Oct 21, 2016 at 17:59

1 Answer 1

2

You install packages by their import path, so you don't use the src/ prefix.

To recompile the runtime package, use:

$ go install -a -v runtime
runtime/internal/sys
runtime/internal/atomic
runtime

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.