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

x/tools/go/packages: cannot load the standard library with Tests == true #26847

Closed
dominikh opened this issue Aug 7, 2018 · 2 comments
Closed
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@dominikh
Copy link
Member

dominikh commented Aug 7, 2018

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

go version devel +5a720d229d Sat Aug 4 16:37:47 2018 +0000 linux/amd64

What did you do?

https://play.golang.org/p/BFlNtG5_s3-

What did you expect to see?

No output

What did you see instead?

2611 lines of error output by the default error handler, reporting type inconsistencies. An excerpt:

/tmp/go/src/archive/zip/struct.go:175:16: cannot use fi.ModTime() (value of type time.Time) as time.Time value in argument to fh.SetModTime
/tmp/go/src/archive/zip/register.go:114:42: cannot convert ioutil.NopCloser (value of type func(r io.Reader) io.ReadCloser) to Decompressor
/tmp/go/src/archive/zip/struct.go:142:9: cannot use (headerFileInfo literal) (value of type headerFileInfo) as os.FileInfo value in return statement: wrong type for method ModTime
/tmp/go/src/archive/tar/common.go:636:12: cannot use fi.ModTime() (value of type time.Time) as time.Time value in struct literal
/tmp/go/src/os/stat_unix.go:20:21: cannot use &fs.sys (value of type *syscall.Stat_t) as *syscall.Stat_t value in argument to f.pfd.Fstat
/tmp/go/src/os/file_posix.go:184:32: cannot use t (variable of type time.Time) as time.Time value in argument to f.pfd.SetWriteDeadline

Note that all of the reported errors seemingly don't make any sense. Also note that the issue goes away when setting Tests = false.

/cc @alandonovan @ianthehat

@gopherbot gopherbot added this to the Unreleased milestone Aug 7, 2018
@ianlancetaylor ianlancetaylor added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Aug 7, 2018
@suzmue
Copy link
Contributor

suzmue commented Aug 8, 2018

This can be recreated with importing two packages from std lib: https://play.golang.org/p/UFGZnKjm502

This issue comes from a regular package incorrectly importing the test variant of another package.

For example, in the import graph, "net/http" imports "crypto/tls [crypto/tls.test]", when it should just be importing "crypto/tls"

@gopherbot
Copy link

Change https://golang.org/cl/128876 mentions this issue: go/packages: prefer import map to identity imports

@golang golang locked and limited conversation to collaborators Aug 10, 2019
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

4 participants