如何在 gometalinter 中禁用 pkcs11?

How to disable pkcs11 in gometalinter?

进行单元测试或构建我的代码时,我必须使用以下命令:

go test --tags nopkcs11

我在 windows 上使用 https://github.com/alecthomas/gometalinter 进行 linting。

gometalinter 运行良好,但每当我 运行 linting 时,我都会看到大量(数百条)这样的消息:

c:\Users\xxxxxxxxx\workspace\go\src\github.com\hyperledger\fabric\bccsp\pkcs11\impl.go:70:24:warning: SessionHandle not declared by package pkcs11 (staticcheck) c:\Users\xxxxxxxxx\workspace\go\src\github.com\hyperledger\fabric\bccsp\pkcs11\impl.go:70:24:warning: SessionHandle not declared by package pkcs11 (staticcheck) c:\Users\xxxxxxxxx\workspace\go\src\github.com\hyperledger\fabric\bccsp\pkcs11\pkcs11.go:39:9:warning: New not declared by package pkcs11 (staticcheck) c:\Users\xxxxxxxxx\workspace\go\src\github.com\hyperledger\fabric\bccsp\pkcs11\pkcs11.go:50:20:warning: cannot range over slots (invalid operand) (staticcheck)

我运行 metalinter 的方式如下:

$ gometalinter.v1 ./...

有没有办法在 gometalinter 上禁用 pkcs11

这有点骇人听闻 + windows 用户必须有一个 unix 终端:

gometalinter.v1 ./... --deadline 10000000ms  | awk '!/pkcs11/'

根据 gometalinter 文档,您似乎可以为您的项目使用 configuration file。您可以使用 Exclude 设置来设置正则表达式,如果消息与模式匹配,则不会输出该消息。