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: inconsistent import panic #16859

Closed
tw4452852 opened this issue Aug 24, 2016 · 4 comments
Closed

x/tools/go: inconsistent import panic #16859

tw4452852 opened this issue Aug 24, 2016 · 4 comments
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@tw4452852
Copy link
Contributor

tw4452852 commented Aug 24, 2016

Please answer these questions before submitting your issue. Thanks!

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

go version devel +00b779a Wed Aug 17 03:12:29 2016 +0000 linux/amd64

  1. What operating system and processor architecture are you using (go env)?
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/tw/golib"
GORACE=""
GOROOT="/home/tw/goroot"
GOTOOLDIR="/home/tw/goroot/pkg/tool/linux_amd64"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build623787547=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
  1. What did you do?

golint github.com/mholt/caddy/caddyhttp/proxy

  1. What did you expect to see?

No errors.

  1. What did you see instead?

Panic sometimes:

panic: inconsistent import:
        func errors.New(text string) error
previously imported as:
        func errors.New(text string) error
 [recovered]
        panic: inconsistent import:
        func errors.New(text string) error
previously imported as:
        func errors.New(text string) error


goroutine 1 [running]:
panic(0x602c00, 0xc4203982b0)
        /home/tw/goroot/src/runtime/panic.go:500 +0x1a0
go/types.(*Checker).handleBailout(0xc4201d6000, 0xc4200455d0)
        /home/tw/goroot/src/go/types/check.go:213 +0xae
panic(0x602c00, 0xc4203982b0)
        /home/tw/goroot/src/runtime/panic.go:458 +0x241
golang.org/x/tools/go/gcimporter15.(*importer).declare(0xc4201d6380, 0x7400c0, 0xc420428460)
        /home/tw/golib/src/golang.org/x/tools/go/gcimporter15/bimport.go:195 +0x17c
golang.org/x/tools/go/gcimporter15.(*importer).obj(0xc4201d6380, 0xfffffffffffffffb)
        /home/tw/golib/src/golang.org/x/tools/go/gcimporter15/bimport.go:223 +0x4ca
golang.org/x/tools/go/gcimporter15.BImportData(0xc420203800, 0xc4201cd170, 0xc420159000, 0xb78, 0xe00, 0xc42015e9d9, 0x6, 0x6, 0xb82076f2ae5f2a8a, 0xa, ...)
        /home/tw/golib/src/golang.org/x/tools/go/gcimporter15/bimport.go:108 +0x3dc
golang.org/x/tools/go/gcimporter15.Import(0xc4201cd170, 0xc42015e9d9, 0x6, 0xc4200bc730, 0x39, 0xc4202b5400, 0x0, 0x0)
        /home/tw/golib/src/golang.org/x/tools/go/gcimporter15/gcimporter.go:178 +0x5d7
github.com/golang/lint.importer.ImportFrom(0x66be98, 0xc4201cd170, 0xc42015e9d9, 0x6, 0xc4200bc730, 0x39, 0x0, 0x628bc0, 0x73d001, 0x7ff82c67f0f0)
        /home/tw/golib/src/github.com/golang/lint/lint16.go:16 +0x58
github.com/golang/lint.(*importer).ImportFrom(0xc4201d2070, 0xc42015e9d9, 0x6, 0xc4200bc730, 0x39, 0x0, 0x2, 0x4, 0x0)
        <autogenerated>:5 +0x97
go/types.(*Checker).collectObjects(0xc4201d6000)
        /home/tw/goroot/src/go/types/resolver.go:196 +0x825
go/types.(*Checker).checkFiles(0xc4201d6000, 0xc420181100, 0x9, 0x10, 0x0, 0x0)
        /home/tw/goroot/src/go/types/check.go:225 +0xaa
go/types.(*Checker).Files(0xc4201d6000, 0xc420181100, 0x9, 0x10, 0xc4201cd260, 0xc420181100)
        /home/tw/goroot/src/go/types/check.go:218 +0x49
go/types.(*Config).Check(0xc4201d4000, 0xc420013697, 0x5, 0xc420015880, 0xc420181100, 0x9, 0x10, 0xc4201c5b80, 0xc42017d010, 0xc42017cfa8, ...)
        /home/tw/goroot/src/go/types/api.go:344 +0x1a3
github.com/golang/lint.(*pkg).typeCheck(0xc4200bcaf0, 0x44f4b0, 0x8100000000000038)
        /home/tw/golib/src/github.com/golang/lint/lint.go:274 +0x40a
github.com/golang/lint.(*pkg).lint(0xc4200bcaf0, 0xc4200c0720, 0xc420101908, 0xc420101900)
        /home/tw/golib/src/github.com/golang/lint/lint.go:130 +0x40
github.com/golang/lint.(*Linter).LintFiles(0xc420045a30, 0xc420045ad0, 0xc42003daa8, 0xc42003dab8, 0x1a1e, 0x0, 0x0)
        /home/tw/golib/src/github.com/golang/lint/lint.go:110 +0x6ef
main.lintFiles(0xc420017400, 0x9, 0xa)
        /home/tw/golib/src/github.com/golang/lint/golint/golint.go:92 +0x23c
main.lintImportedPackage(0xc420072700, 0x0, 0x0)
        /home/tw/golib/src/github.com/golang/lint/golint/golint.go:136 +0x363
main.lintPackage(0x7ffe8e47e406, 0x26)
        /home/tw/golib/src/github.com/golang/lint/golint/golint.go:112 +0x75
main.main()
        /home/tw/golib/src/github.com/golang/lint/golint/golint.go:57 +0x1c1

@griesemer
Copy link
Contributor

@tw4452852 What does "sometimes" mean? Do you run golint multiple times?

Also, can you see if you still have packages installed that are compiled with an older compiler? Specifically, please look at (open in an editor) the file $GOROOT/pkg/darwin_amd64/errors.a and let me know what the first 20 lines look like. If you find a $$ header followed by textual export data (rather that a $$B header) on line 9, you have stale packages and you should remove the $GOTOOT/pkg directory and recompile your std library.

If you have an up-to-date std library (all compiled with latest compiler), please provide more detailed instructions how to recreate this error (which version of golint, other packages installed). Thanks.

Please also note that we don't guarantee interoperability of package files between different compiler versions - and it looks like you're working with a compiler off tip.

@griesemer griesemer added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Aug 24, 2016
@griesemer griesemer self-assigned this Aug 24, 2016
@griesemer griesemer added this to the Go1.8 milestone Aug 24, 2016
@tw4452852
Copy link
Contributor Author

@griesemer

What does "sometimes" mean? Do you run golint multiple times?

Yes, I run golint multiple times. Sometimes it finishes w/o any errors, but it panics sometimes. Also this panic only happens when I lint directory or package rather than single file.

Also, can you see if you still have packages installed that are compiled with an older compiler? Specifically, please look at (open in an editor) the file $GOROOT/pkg/darwin_amd64/errors.a and let me know what the first 20 lines look like. If you find a $$ header followed by textual export data (rather that a $$B header) on line 9, you have stale packages and you should remove the $GOTOOT/pkg directory and recompile your std library.

I use the tip:

go version
go version devel +1472221 Thu Aug 25 00:19:32 2016 +0000 linux/amd64

And here is first 20 lines of $GOROOT/pkg/linux_amd64/errors.a:

cat -n $GOROOT/pkg/linux_amd64/errors.a| head -20
     1  !<arch>
     2  __.PKGDEF       0           0     0     644     373       `
     3  go object linux amd64 devel +1472221 Thu Aug 25 00:19:32 2016 +0000 X:framepointer
     4  build id "c0f935399829faef0243fb28d53100a38589efd2"
     5  ----
     6
     7  build id "c0f935399829faef0243fb28d53100a38589efd2"
     8
     9  $$B
    10  version 1
    11
    12  
text·2& errors  7|SGOROOT/src/errors/errors.goNew 
errorString
    13  s       Error<e·2esc:0x22 
                                  öV&TP<
                                       ¼¼¼ör
                                            ¼¼
    14  $$
    15  _go_.o          0           0     0     644     3152      `
    16  go object linux amd64 devel +1472221 Thu Aug 25 00:19:32 2016 +0000 X:framepointer
    17  build id "c0f935399829faef0243fb28d53100a38589efd2"
    18  ----
    19
    20


If you have an up-to-date std library (all compiled with latest compiler), please provide more detailed instructions how to recreate this error (which version of golint, other packages installed). Thanks.

As for golint version, I'm at this commit: c7bacac2b21ca01afa1dee0acf64df3ce047c28f

As for reproduce steps:

  1. Just go get -u github.com/mholt/caddy/caddy
  2. run golint several times: golint github.com/mholt/caddy/caddyhttp/proxy

@mattyw
Copy link
Contributor

mattyw commented Aug 25, 2016

I had a similar thing recently after upgrading to 1.7. My issue was with go vet (the same as #16112). I blew away the contents of $GOPATH/pkg and now it seems fine

@griesemer
Copy link
Contributor

@tw4452852 I cannot reproduce this on my machine, even with dozens of golint calls.

I'm at go version devel +8f3c8a3 Fri Aug 26 20:06:58 2016 +0000 darwin/amd64 (at commit 8f3c8a3).

I installed the same version of golint as you have.

And I installed caddy per the instructions (at commit 191ec27c261553c429cf5d6df2d14dce386417ff)

I'm not sure how it's possible for golint to pass sometimes and sometimes not, w/o changes to the files being linted. At least the import/export code is very deterministic.

I've tried this also with my latest devel version (not yet committed) that has better support for export format version skew detection - same result.

I suspect that you still have some package files that use an outdated format somewhere. I'd recommend blowing away all installed package files and to recompile with the latest compiler. I'm reasonably confident that this will solve the problem.

I have several pending changes (see #16881) which should hopefully make these errors a thing of the past.

Closing for now. If you still see a problem after re-installing your packages and upgrading to the latest compiler, please re-open this. Thanks.

@golang golang locked and limited conversation to collaborators Aug 26, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

4 participants