golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
123.72k stars 17.62k forks source link

cmd/go: go get -t -u fails with vendor in testcode #18219

Closed rsc closed 7 years ago

rsc commented 7 years ago
$ go get -u -t github.com/grafana/grafana/...
package github.com/grafana/grafana/pkg/api
    imports github.com/grafana/grafana/vendor/github.com/smartystreets/goconvey/convey: must be imported as github.com/smartystreets/goconvey/convey
package github.com/grafana/grafana/pkg/components/simplejson
    imports github.com/grafana/grafana/vendor/github.com/bmizerany/assert: must be imported as github.com/bmizerany/assert
package github.com/grafana/grafana/vendor/github.com/bmizerany/assert/example
    imports assert: unrecognized import path "assert" (import path does not begin with hostname)
package github.com/grafana/grafana/vendor/golang.org/x/oauth2/google
    imports google.golang.org/cloud/compute/metadata: code in directory /usr/local/google/home/rsc/go100/tmp/src/google.golang.org/cloud/compute/metadata expects import "cloud.google.com/go/compute/metadata"
package github.com/grafana/grafana/vendor/golang.org/x/oauth2/google
    imports github.com/grafana/grafana/vendor/golang.org/x/oauth2/google: must be imported as golang.org/x/oauth2/google
$ 

The problem seems to be that the vendored imports are in test code.

For example:

package github.com/grafana/grafana/pkg/components/simplejson
    imports github.com/grafana/grafana/vendor/github.com/bmizerany/assert: must be imported as github.com/bmizerany/assert

But github.com/grafana/grafana/pkg/components/simplejson/simplejson_test.go does import that code as "github.com/bmizerany/assert".

bradfitz commented 7 years ago

@rsc, I thought I saw a fix from you for this, but now I don't see it here. Maybe I'm confused. Are you working on this?

rsc commented 7 years ago

I am working on this. Didn't make much progress on it Friday.

gopherbot commented 7 years ago

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