Running vet with Go 1.4

In Travis CI environment I’m running go get golang.org/x/tools/cmd/vet to install the vet tool. Unfortunately yesterday it started erroring on the Go 1.4 build:

$ go get golang.org/x/tools/cmd/vet
package golang.org/x/tools/cmd/vet
	imports go/constant: unrecognized import path "go/constant"
package golang.org/x/tools/cmd/vet
	imports go/importer: unrecognized import path "go/importer"
package golang.org/x/tools/cmd/vet
	imports go/types: unrecognized import path "go/types"

In a recent commit it looks to me like the vet tool should still run on Go 1.4:

This change will ensure that the tree continues to work with go1.4.1.

Am I missing something?

(Build job succeeds on Go 1.5 and tip.)

You should not be using this version of vet. vet comes with Go by default starting from 1.5. See https://github.com/golang/tools/commit/5a90b2958f12ca0f046ffe2eb1523c5896af5dae#diff-8f0e99d54c3bfafc906191263fe5fb53

If you build your library/app using different versions of Go during build process than probably you should modify the build process to run vet only once using the latest version of Go.

1 Like

Hm, okay, cool. I do not know how to do that with Travis CI. (I know it’s off topic. But if someone has already figured it out feel free to share.) Thanks!

Something like:

language: go

go:
  - 1.5.2
  - tip

script:
  - go test -v ./...
  - if [[ `go version` =~ go1.5 ]] ; then go vet ./... ; fi
1 Like

Only Go 1.4 is affected, and that is already excluded in that travis config.

That is true. On the other hand why would you want to run different versions of vet (or any other similar tool) multiple times during the build? I think running the latest version once should be enough.

Actually, it just started working again.

Thanks for the script idea though!

It should be fixed now:

Ah, thanks @tiffany! That explains why it magically started working again. :smile:

(PS. I see that you work at Intel; my brother works up there at Nanometrics and was just asking me the other day about using Go. He heard some teams at Intel were using it so it sparked some interest… I might have questions later about adopting Go in a corporate environment.)

vet from the tools repo has been fixed but it doesn’t change the fact that it is not the latest version and doesn’t include the latest bug fixes and improvements.

Sounds good to me, but not sure how much I can help since my group acts more like a little startup within Intel and decided to use Go. I’ll try though :).

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.