New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why "go build" depends on $GOROOT/src/pkg #4635

Closed
gopherbot opened this Issue Jan 9, 2013 · 2 comments

Comments

Projects
None yet
4 participants
@gopherbot

gopherbot commented Jan 9, 2013

by xuxinhua1984:

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 ?
@alberts

This comment has been minimized.

Show comment
Hide comment
@alberts

alberts Jan 9, 2013

Contributor

Comment 1:

issue #2775, more or less...
Contributor

alberts commented Jan 9, 2013

Comment 1:

issue #2775, more or less...
@davecheney

This comment has been minimized.

Show comment
Hide comment
@davecheney

davecheney Jan 9, 2013

Contributor

Comment 2:

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.

Status changed to Duplicate.

Merged into issue #2775.

Contributor

davecheney commented Jan 9, 2013

Comment 2:

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.

Status changed to Duplicate.

Merged into issue #2775.

@rsc rsc added this to the Go1.1 milestone Apr 14, 2015

@rsc rsc removed the go1.1 label Apr 14, 2015

@golang golang locked and limited conversation to collaborators Jun 24, 2016

This issue was closed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.