首先,//+build将逐渐取代//go:build,在Go Version1.16-1.18作为过渡期,两种注释都可以使用。参见官网https://www.jetbrains.com/help/go/configuring-build-constraints-and-vendoring.html
但是在1.16以下的版本不能使用//+build,若使用便会报错error: goland --build constraints exclude all Go files。
1.16以下版本应使用//go:build
并且进行如下设置