Skip to content

panic on go vet - inconsistent import net/http.DefaultTransport net/http.RoundTripper #16781

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
CpuID opened this issue Aug 18, 2016 · 3 comments

Comments

@CpuID
Copy link

CpuID commented Aug 18, 2016

Please answer these questions before submitting your issue. Thanks!

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

1.7

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

Ubuntu 14.04.4 LTS Trusty, Go installed from .tgz on website. go version go1.7 linux/amd64, 3.19.0-31-generic kernel.

  1. What did you do?

go vet on an application with some net/http imports, specifically:

deploys_api.go: "net/http"
deploys_api.go: "net/http/httptest"
deploys_api.go: "net/url"
docker_image_registry.go:   "net/http"
  1. What did you expect to see?

Warnings about code or graceful exit.

  1. What did you see instead?

panic:

$ go vet
panic: inconsistent import:
    var net/http.DefaultTransport net/http.RoundTripper
previously imported as:
    var DefaultTransport net/http.RoundTripper
 [recovered]
    panic: inconsistent import:
    var net/http.DefaultTransport net/http.RoundTripper
previously imported as:
    var DefaultTransport net/http.RoundTripper


goroutine 1 [running]:
panic(0x674b20, 0xc420368870)
    /usr/local/go/src/runtime/panic.go:500 +0x1a1
go/types.(*Checker).handleBailout(0xc4200a4540, 0xc4204558d8)
    /usr/local/go/src/go/types/check.go:213 +0xae
panic(0x674b20, 0xc420368870)
    /usr/local/go/src/runtime/panic.go:458 +0x243
go/internal/gcimporter.(*importer).declare(0xc42048a000, 0x7f64a0, 0xc4203c7130)
    /usr/local/go/src/go/internal/gcimporter/bimport.go:175 +0x17c
go/internal/gcimporter.(*importer).obj(0xc42048a000, 0xfffffffffffffffc)
    /usr/local/go/src/go/internal/gcimporter/bimport.go:195 +0x1b4
go/internal/gcimporter.BImportData(0xc420013140, 0xc420686000, 0x1cd99e, 0x1ffe00, 0xc420142287, 0x8, 0x0, 0x8, 0x0, 0x0)
    /usr/local/go/src/go/internal/gcimporter/bimport.go:88 +0x390
go/internal/gcimporter.Import(0xc420013140, 0xc420142287, 0x8, 0x6cf324, 0x1, 0xc42004a730, 0x0, 0x0)
    /usr/local/go/src/go/internal/gcimporter/gcimporter.go:166 +0x551
go/importer.gcimports.ImportFrom(0xc420013140, 0xc420142287, 0x8, 0x6cf324, 0x1, 0x0, 0xc42037c690, 0x0, 0x0)
    /usr/local/go/src/go/importer/importer.go:70 +0x67
go/types.(*Checker).collectObjects(0xc4200a4540)
    /usr/local/go/src/go/types/resolver.go:191 +0x826
go/types.(*Checker).checkFiles(0xc4200a4540, 0xc420315800, 0x23, 0x40, 0x0, 0x0)
    /usr/local/go/src/go/types/check.go:225 +0xaa
go/types.(*Checker).Files(0xc4200a4540, 0xc420315800, 0x23, 0x40, 0xc420375200, 0xc42014d960)
    /usr/local/go/src/go/types/check.go:218 +0x49
go/types.(*Config).Check(0xc42037e940, 0xc42000fc88, 0x4, 0xc42001b180, 0xc420315800, 0x23, 0x40, 0xc42037c500, 0x40, 0xc4200001a0, ...)
    /usr/local/go/src/go/types/api.go:344 +0x1a3
main.(*Package).check(0xc420271860, 0xc42001b180, 0xc420315800, 0x23, 0x40, 0x0, 0xc42034b400)
    /usr/local/go/src/cmd/vet/types.go:76 +0x370
main.doPackage(0x6cf324, 0x1, 0xc42000a250, 0x23, 0x23, 0x0, 0x1)
    /usr/local/go/src/cmd/vet/main.go:336 +0x999
main.main()
    /usr/local/go/src/cmd/vet/main.go:244 +0x345
exit status 2
@CpuID
Copy link
Author

CpuID commented Aug 18, 2016

Can confirm was working fine on 1.6.2, didn't install 1.6.3.

@bradfitz
Copy link
Contributor

This is a bug in "go vet". Dup of #16775, #16720, #16680, #16112, etc.

The panic is caused by out-of-date .o files, and the fact that we have a new exporter. go install will fix it because it updates the .o files.

/cc @griesemer (you should probably make a golang.org/s/ shortlink to a doc explaining this)

@CpuID
Copy link
Author

CpuID commented Aug 18, 2016

@bradfitz thanks!

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