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: prebuilt net/http not used #26993

Closed
neild opened this issue Aug 14, 2018 · 8 comments
Closed

cmd/go: prebuilt net/http not used #26993

neild opened this issue Aug 14, 2018 · 8 comments
Labels
FrozenDueToAge modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@neild
Copy link
Contributor

neild commented Aug 14, 2018

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

go version devel +c882f4b6b1 Tue Aug 14 20:40:15 2018 +0000 linux/amd64

Does this issue reproduce with the latest release?

yes

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

GOARCH="amd64"
GOBIN=""
GOCACHE="/tmp/gocache"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/usr/local/google/home/dneil/go"
GOPROXY=""
GORACE=""
GOROOT="/tmp/go"
GOTMPDIR=""
GOTOOLDIR="/tmp/go/pkg/tool/linux_amd64"
GCCGO="/usr/bin/gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/usr/local/google/home/dneil/foo/go.mod"
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-build560741844=/tmp/go-build -gno-record-gcc-switches"

What did you do?

$ cat go.mod
module misago.org/foo
$ cat foo.go
package foo
import _ "net/http"
$ rm -rf /tmp/gocache
$ GOCACHE=/tmp/gocache go build -v .

What did you expect to see?

With a cold cache, this should just build the current package.

misago.org/foo

What did you see instead?

The net/http package and a number of its dependencies are rebuilt.

golang_org/x/crypto/cryptobyte/asn1
golang_org/x/net/dns/dnsmessage
golang_org/x/crypto/curve25519
golang_org/x/text/transform
golang_org/x/crypto/poly1305
golang_org/x/crypto/cryptobyte
golang_org/x/crypto/internal/chacha20
golang_org/x/text/unicode/bidi
golang_org/x/net/http2/hpack
golang_org/x/text/unicode/norm
golang_org/x/crypto/chacha20poly1305
net
golang_org/x/text/secure/bidirule
golang_org/x/net/idna
golang_org/x/net/http/httpproxy
net/textproto
crypto/x509
golang_org/x/net/http/httpguts
crypto/tls
net/http/httptrace
net/http
misago.org/foo

This doesn't happen with other packages; e.g., fmt.

@andybons andybons added modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Aug 14, 2018
@andybons andybons added this to the Go1.11 milestone Aug 14, 2018
@andybons
Copy link
Member

@rsc @bcmills

@agnivade
Copy link
Contributor

Possibly related to #26988

@golang golang deleted a comment Aug 15, 2018
@golang golang deleted a comment Aug 15, 2018
@andybons
Copy link
Member

@bradfitz @ianlancetaylor

@ianlancetaylor
Copy link
Contributor

It's because of the vendor in the path. When the " golang_org/x/cryto/cryptobyte/asn1" package is built as part of go install std, the build ID computation done by (*Builder).buildActionID writes

import \"vendor/golang_org/x/crypto/cryptobyte/asn1\"\n

to the hash key. When the build of the module is done later, the build ID computation writes

import \"golang_org/x/crypto/cryptobyte/asn1\"\n

That is, the vendor part of the string is present when building the package but not when checking whether the package needs to rebuilt.

This is presumably happening because go install std expands into installing vendor/golang_org/x/crypto/cryptobyte/asn1. For example, go install vendor/golang_org/x/crypto/cryptobyte/asn1 succeeds. go install golang_org/x/crypto/cryptobyte/asn1 fails with

can't load package: package golang_org/x/crypto/cryptobyte/asn1: cannot find package "golang_org/x/crypto/cryptobyte/asn1" in any of:
	/home/iant/go/src/golang_org/x/crypto/cryptobyte/asn1 (from $GOROOT)
	/home/iant/gopath/src/golang_org/x/crypto/cryptobyte/asn1 (from $GOPATH)

@ianlancetaylor
Copy link
Contributor

This seems related to #23970 and https://golang.org/cl/125836. Perhaps the go/build package needs to explicitly remove "vendor/" from the ImportPath field of a package in the standard library.

CC @bcmills @rsc

@rsc
Copy link
Contributor

rsc commented Aug 17, 2018

Duplicate of #26993. I think the rebuild is fine for Go 1.11 and possibly just in general.

@rsc rsc modified the milestones: Go1.11, Go1.12 Aug 17, 2018
@rsc rsc closed this as completed Aug 17, 2018
@rsc
Copy link
Contributor

rsc commented Aug 17, 2018

Sorry, this is #26993. Duplicate of #26988.

@thepudds
Copy link
Contributor

thepudds commented Sep 1, 2018

See also this comment #26988 (comment) for a brief explanation on why this is happening.

@golang golang locked and limited conversation to collaborators Sep 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge modules 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

7 participants