Skip to content
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

cmd/go: go get no longer creates $GOPATH/pkg dir in 1.10 #24360

Closed
asottile opened this issue Mar 12, 2018 · 7 comments
Closed

cmd/go: go get no longer creates $GOPATH/pkg dir in 1.10 #24360

asottile opened this issue Mar 12, 2018 · 7 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@asottile
Copy link
Contributor

asottile commented Mar 12, 2018

What version of Go are you using (go version)?

$ go version
go version go1.10 linux/amd64

Does this issue reproduce with the latest release?

Yes, 1.10 is currently the latest release

What operating system and processor architecture are you using (go env)?

$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/asottile/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/tmp/test/gopath"
GORACE=""
GOROOT="/tmp/test/go"
GOTMPDIR=""
GOTOOLDIR="/tmp/test/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build899975321=/tmp/go-build -gno-record-gcc-switches"

What did you do?

rm -rf gopath
mkdir gopath
export GOPATH=$PWD/gopath
go get github.com/golang/example/hello
ls gopath

What did you expect to see?

...
$ ls gopath
bin pkg src

What did you see instead?

(for the other version of go I have installed (1.6.2) I see this)

$ ls gopath
bin  src
@asottile
Copy link
Contributor Author

Not a big deal -- just I didn't see any mention of this in the changelog (or I missed it!)

@mvdan
Copy link
Member

mvdan commented Mar 12, 2018

See the caching changes - cached package builds now reside in $GOCACHE.

@mvdan mvdan closed this as completed Mar 12, 2018
@asottile
Copy link
Contributor Author

The docs mention the new cache, but are a bit brief about the pkg directory: https://tip.golang.org/doc/go1.10#build

@mvdan
Copy link
Member

mvdan commented Mar 12, 2018

It's not terribly clear whether or not $GOPATH/pkg is used anymore, so I'm going to reopen for now.

@mvdan mvdan reopened this Mar 12, 2018
@andybons
Copy link
Member

/cc @ianlancetaylor @rsc

@andybons andybons added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Mar 13, 2018
@andybons andybons added this to the Unplanned milestone Mar 13, 2018
@dmitshur dmitshur changed the title 1.10: pkg dir no longer created by go get? cmd/go: go get no longer creates $GOPATH/pkg dir in 1.10 Mar 20, 2018
@dmitshur
Copy link
Contributor

This is related to (or duplicate of) issue #4719.

@ianlancetaylor
Copy link
Contributor

Running go get is documented as fetching the binaries and then running go install. The same change has occurred for go install: the pkg directory is not created if you install a main package. This is documented in the release notes for Go 1.10:

The go install command now installs only the packages and commands listed directly on the command line. For example, go install cmd/gofmt installs the gofmt program but not any of the packages on which it depends. The new build cache makes future commands still run as quickly as if the dependencies had been installed. To force the installation of dependencies, use the new go install -i flag. Installing dependency packages should not be necessary in general, and the very concept of installed packages may disappear in a future release.

Since go get is documented to effectively use go install, and since go install is documented as having changed, I don't think there is anything to do here.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

6 participants