doumeng2637
2017-11-08 14:00
浏览 80
已采纳

如何在gometalinter中禁用pkcs11?

When unit test, or build my code, I have to use the following command:

go test --tags nopkcs11

I am using https://github.com/alecthomas/gometalinter on windows for linting.

The gometalinter works well, but whenever I run linting, I can see a large number (hundreds) of messages like this:

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)

I run the metalinter in the following manner:

$ gometalinter.v1 ./...

Is there a way to disable pkcs11 on gometalinter?

图片转代码服务由CSDN问答提供 功能建议

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

去测试-标记nopkcs11

我正在使用 https://github.com/alecthomas/gometalinter windows 上用于掉毛。

gometalinter可以很好地工作,但是无论何时 我运行linting,我可以看到大量(数百个)这样的消息:

c:\ Users \ xxxxxxxxx \ workspace \ go \ src \ github.com \ hyperledger \ fabric \ bccsp \ pkcs11 \ impl.go:70:24:warning:包pkcs11未声明SessionHandle(staticcheck) c:\ Users \ xxxxxxxxx \ workspace \ go \ src \ github.com \ hyperledger \ fabric \ bccsp \ pkcs11 \ impl.go:70:24:warning:包pkcs11未声明SessionHandle(staticcheck) c:\ Users \ xxxxxxxxx \ workspace \ go \ src \ github.com \ hyperledger \ fabric \ bccsp \ pkcs11 \ pkcs11.go :39:9:警告:软件包pkcs11(staticcheck)未声明新消息 c:\ Users \ xxxxxxxxx \ worksp ace \ go \ src \ github.com \ hyperledger \ fabric \ bccsp \ pkcs11 \ pkcs11.go:50:20:warning:不能在插槽范围内(无效的操作数)(静态检查) \ n

我以以下方式运行metalinter:

$ gometalinter.v1 ./...

是否可以在gometalinter上禁用 pkcs11

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • douguazhi5966 2017-11-08 14:25
    已采纳

    This is a bit of a hack + a windows user will have to have a unix terminal:

    gometalinter.v1 ./... --deadline 10000000ms  | awk '!/pkcs11/'
    
    已采纳该答案
    打赏 评论
  • duandao1931 2017-11-08 15:37

    It looks like you can use a configuration file for your project, per the gometalinter documentation. You can use the Exclude setting to set regular expressions that, if a message matches the pattern, the message will not be output.

    打赏 评论

相关推荐 更多相似问题