Skip to content

x/{tools,net}: importer: inconsistent definition for type #15491

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

Closed
OneOfOne opened this issue Apr 29, 2016 · 8 comments
Closed

x/{tools,net}: importer: inconsistent definition for type #15491

OneOfOne opened this issue Apr 29, 2016 · 8 comments
Milestone

Comments

@OneOfOne
Copy link
Contributor

Please answer these questions before submitting your issue. Thanks!

  1. What version of Go are you using (go version)?
    go version devel +d8d3351 2016-04-29 16:20:18 +0000 linux/amd64 (compiled with GO_GCFLAGS "-newexport=0" to support gocode).
  2. What operating system and processor architecture are you using (go env)?
  3. What did you do?
    go get -u golang.org/x/tools/...
  4. What did you expect to see?
    no error
  5. What did you see instead?

The apocalypse, the sky started falling, the rivers turned red, and then this destroyed my terminal:
https://gist.github.com/OneOfOne/5cc8d8dd3230e35bf3083e9c7ceee1c5

I can't bisect now but I'd almost bet it has something to do with fa9435c

@griesemer
Copy link
Contributor

This is related to the new importer (the panic says: "importer: ...). So, no, this is not related to the change you're suspecting.

Try go get -gcflags="-newexport=0" -u golang.org/x/tools/... and let me know if that helps.

(You have compiled the std library with -newexport=0, and while both old and new export format should be interchangeable, perhaps they are not so much...).

@griesemer griesemer self-assigned this Apr 29, 2016
@griesemer griesemer added this to the Go1.7 milestone Apr 29, 2016
@OneOfOne
Copy link
Contributor Author

@griesemer yeah that works, after rm -rf $GOPATH/pkg/.

@griesemer
Copy link
Contributor

I can reproduce this. It appears to happen when the std lib is compiled with -newexport=0 but go get is run without -gcflags="-newexport=0" (and thus uses the new export format). It does not happen when the new (or old, for that matter) export format is used throughout.

gri-macmini:x gri$ go get -u golang.org/x/tools/...
# golang.org/x/tools/blog
tools/blog/blog.go:24: inconsistent definition for type reflect.rtype during import
    struct { size uintptr; ptrdata uintptr; hash uint32; tflag reflect.tflag; align uint8; fieldAlign uint8; kind uint8; alg *reflect.typeAlg; gcdata *byte; str reflect.nameOff; _ int32 } (in "encoding/json")
    struct { size uintptr; ptrdata uintptr; hash uint32; tflag reflect.tflag; align uint8; fieldAlign uint8; kind uint8; alg *reflect.typeAlg; gcdata *byte; str reflect.nameOff; _ int32 } (in "golang.org/x/tools/present")
# golang.org/x/tools/cmd/eg
tools/cmd/eg/eg.go:18: internal compiler error: importer: empty package name in import

goroutine 1 [running]:
runtime/debug.Stack(0x0, 0x0, 0x0)
    /Users/gri/go/src/runtime/debug/stack.go:24 +0x6f
cmd/compile/internal/gc.Fatalf(0x4c6464, 0x26, 0x0, 0x0, 0x0)
    /Users/gri/go/src/cmd/compile/internal/gc/subr.go:158 +0x236
cmd/compile/internal/gc.(*importer).pkg(0xc8208998c0, 0xc820a3a17c)
    /Users/gri/go/src/cmd/compile/internal/gc/bimport.go:204 +0x68a
cmd/compile/internal/gc.(*importer).param(0xc8208998c0, 0x1, 0x1)
    /Users/gri/go/src/cmd/compile/internal/gc/bimport.go:572 +0x15a
cmd/compile/internal/gc.(*importer).paramList(0xc8208998c0, 0xc820a402c0, 0x3, 0x3)
    /Users/gri/go/src/cmd/compile/internal/gc/bimport.go:546 +0xa0
cmd/compile/internal/gc.(*importer).typ(0xc8208998c0, 0xffffffffffffff12)
    /Users/gri/go/src/cmd/compile/internal/gc/bimport.go:363 +0x242
cmd/compile/internal/gc.(*importer).typ(0xc8208998c0, 0xc8209e6150)
    /Users/gri/go/src/cmd/compile/internal/gc/bimport.go:410 +0xedb
cmd/compile/internal/gc.(*importer).field(0xc8208998c0, 0xc8209e4990)
    /Users/gri/go/src/cmd/compile/internal/gc/bimport.go:469 +0x4b
cmd/compile/internal/gc.(*importer).fieldList(0xc8208998c0, 0xffffffffffffff16, 0xc8209e2690, 0x0)
    /Users/gri/go/src/cmd/compile/internal/gc/bimport.go:459 +0x85
cmd/compile/internal/gc.(*importer).typ(0xc8208998c0, 0xc8209e25f0)
    /Users/gri/go/src/cmd/compile/internal/gc/bimport.go:406 +0xb74
cmd/compile/internal/gc.(*importer).typ(0xc8208998c0, 0xffffffffffffff12)
    /Users/gri/go/src/cmd/compile/internal/gc/bimport.go:341 +0x138
cmd/compile/internal/gc.(*importer).typ(0xc8208998c0, 0x0)
    /Users/gri/go/src/cmd/compile/internal/gc/bimport.go:410 +0xedb
cmd/compile/internal/gc.(*importer).param(0xc8208998c0, 0x1, 0x2)
    /Users/gri/go/src/cmd/compile/internal/gc/bimport.go:553 +0x30
cmd/compile/internal/gc.(*importer).paramList(0xc8208998c0, 0xffffffffffffff13, 0xc8209e2550, 0xefa5)
    /Users/gri/go/src/cmd/compile/internal/gc/bimport.go:546 +0xa0
cmd/compile/internal/gc.(*importer).typ(0xc8208998c0, 0xc820959dc0)
    /Users/gri/go/src/cmd/compile/internal/gc/bimport.go:414 +0xe09
cmd/compile/internal/gc.(*importer).field(0xc8208998c0, 0xc8209dfef0)
    /Users/gri/go/src/cmd/compile/internal/gc/bimport.go:469 +0x4b
cmd/compile/internal/gc.(*importer).fieldList(0xc8208998c0, 0xffffffffffffff16, 0xc8208d3ef0, 0x0)
    /Users/gri/go/src/cmd/compile/internal/gc/bimport.go:459 +0x85
cmd/compile/internal/gc.(*importer).typ(0xc8208998c0, 0xc8203d41e0)
    /Users/gri/go/src/cmd/compile/internal/gc/bimport.go:406 +0xb74
cmd/compile/internal/gc.(*importer).typ(0xc8208998c0, 0x0)
    /Users/gri/go/src/cmd/compile/internal/gc/bimport.go:341 +0x138
cmd/compile/internal/gc.(*importer).obj(0xc8208998c0, 0xfffffffffffffffd)
    /Users/gri/go/src/cmd/compile/internal/gc/bimport.go:250 +0x903
cmd/compile/internal/gc.Import(0xc82009c480)
    /Users/gri/go/src/cmd/compile/internal/gc/bimport.go:88 +0x338
cmd/compile/internal/gc.importfile(0xc82043c790, 0x0, 0x0, 0x0)
    /Users/gri/go/src/cmd/compile/internal/gc/main.go:825 +0x902
cmd/compile/internal/gc.(*parser).importdcl(0xc82043c770)
    /Users/gri/go/src/cmd/compile/internal/gc/parser.go:341 +0x160
cmd/compile/internal/gc.(*parser).import_(0xc82043c770)
    /Users/gri/go/src/cmd/compile/internal/gc/parser.go:300 +0x67
cmd/compile/internal/gc.(*parser).file(0xc82043c770)
    /Users/gri/go/src/cmd/compile/internal/gc/parser.go:268 +0x54
cmd/compile/internal/gc.parse_file(0xc82009c180)
    /Users/gri/go/src/cmd/compile/internal/gc/parser.go:31 +0x4a
cmd/compile/internal/gc.Main()
    /Users/gri/go/src/cmd/compile/internal/gc/main.go:331 +0x144e
cmd/compile/internal/amd64.Main()
    /Users/gri/go/src/cmd/compile/internal/amd64/galign.go:96 +0x381
main.main()
    /Users/gri/go/src/cmd/compile/main.go:33 +0x286

Analysis: The original error report (inconsistent definition...) is likely due to incorrect *Symbol setup in the compiler (wrong package). The 2nd error (empty package...) may be related.

@griesemer
Copy link
Contributor

The 2nd error is due to _ (blank) parameters exported incorrectly (fix in progress, with some luck over the weekend).

@OneOfOne
Copy link
Contributor Author

@griesemer Good to hear, when you push it to Garret, tag me as a reviewer and I'll give it a test.

oneofone x gmail

@griesemer griesemer changed the title x/{tools,net}: internal compiler error x/{tools,net}: importer: inconsistent definition for type May 2, 2016
@gopherbot
Copy link
Contributor

CL https://golang.org/cl/22714 mentions this issue.

@griesemer
Copy link
Contributor

@OneOfOne The above change fixes the problem as far as I can tell. Please comment here if you see otherwise. Thanks.

@OneOfOne
Copy link
Contributor Author

OneOfOne commented May 3, 2016

@griesemer I tested it with a clean $GOPATH/pkg, seems to fix the bug and works fine with all the packages that used to be broken. 👍

@golang golang locked and limited conversation to collaborators May 3, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants