LoginSignup
4
3

More than 3 years have passed since last update.

Golangで「特定のpackage以外の全てのpackageに対してtest」を行う方法

Posted at

TL;DR

go test `go list ./... | grep -v 除外したいパッケージへのpath`

解説

go test の後ろにはテストしたいパッケージ名を書いていく。(全実行したい場合は go test ./...)


go test internal/hoge internal/fuga

go list を実行すると次のようにパッケージのリストを出力してくれるので

github.com/seya/test/server/internal/hoge
github.com/seya/test/server/internal/fuga

除外して欲しいものをgrepで除外して渡してあげればok

4
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
3