You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The code is:(test.go)
package main
import "fmt"
func main() {
fmt.Println("Hello, World")
}
Then, I build it: go build test.go. It is OK.
But when I delete $GOROOT/src/pkg/fmt directory, then build test.go, it failed:
cannot find package "fmt" in any of:
/usr/local/go/src/pkg/fmt (from $GOROOT)
However, I can build it by 6g and link it by 6l:
go tool 6g test.go
go tool 6l test.6
this will generate 6.out
Why "go build" depends on $GOROOT/src/pkg ?
The text was updated successfully, but these errors were encountered:
The go tool currently requires the source to be present, even if the compiled package is
present. There is a workaround, if you leave an empty directory, _with_ an mtime older
than the compiled package, in src/ then the go tool _should_ work.
by xuxinhua1984:
The text was updated successfully, but these errors were encountered: