go tool package matching

The go tool has some special package matching arguments. You can do the following:

go test std
go vet std
go list all

std will match all the standard packages in the go distribution. all matches all the packages in all the GOPATHs you have set.

There’s another matching argument, the dot expansion, that is the most useful:

go test stathat/...
go test ./...
go fix ./...

This three dot expansion matches anything. The first command will find stathat in a GOPATH and then test all the packages it finds below it. It can be run from anywhere. The second and third commands will only look for packages below the current directory.

You can put the dot expansion anywhere. To test all the packages in stathat that start with c:

go test stathat/.../c...

For more information, run go help package.

Comments? Send us a tweet.


Did that Elastic Load Balancer request come over HTTPS or HTTP?
Automatic Alerts