Golint:有些问题可以通过 VSCode 而不是命令行检测

Golint: some issues can detect by VSCode but not command line

有很多VSCode的lint问题,后面使用Golint可以检测到golint的命令行版本检测不到。因此 CI/CD 工具无法检测到所有问题。例如下面的代码:

ctx, _ := context.WithTimeout(context.Background(), timeout)

VSCode 会有警告:

the cancel function returned by context.WithTimeout should be called, not discarded, to avoid a context leak

但是当我运行命令行版本的Golint时,它无法检测到。我想知道Golint是否有一些配置落后但发现 none.

此错误消息来自 golangci/govet, one of the activated by default linters of golangci/golangci-lint

I mean I have set up it using golint

这与 golint (golang/lint) 不同,后者不包括该检查。