简体   繁体   English

golangci-lint 运行命令显示 makefile 中的错误

[英]golangci-lint run command shows errors in makefile

I have created a make file to run some bash commands for Go.我创建了一个 make 文件来为 Go 运行一些 bash 命令。

This is check.sh file这是 check.sh 文件

This is my make file这是我的制作文件

Error is: make: *** [Makefile:23: check] Error 1错误是: make: *** [Makefile:23: check] Error 1

How can I solve this issue?我该如何解决这个问题?

According to this stackoverflow answer that happens if one of the commands exits with exit code.= 0. That is the case if golangci-lint finds something to complain about.根据这个 stackoverflow 答案,如果其中一个命令以退出代码退出。= 0。如果 golangci-lint 发现有什么可抱怨的,就是这种情况。

Try putting the call to golangci-lint directly in the make file.尝试直接在 make 文件中调用 golangci-lint。

From my Makefiles:从我的 Makefile 中:

lint:
    golangci-lint run

Have you created mod file in the root folder?您是否在根文件夹中创建了 mod 文件?

go mod init <root folder /Application Name>

if yes, check for the bin folder if the specified package is installed, if not install the package,如果是,检查 bin 文件夹是否安装了指定的 package,如果没有安装 package,

go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest

Then add it in make file然后将其添加到make文件中

lint:
       golangci-lint run

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM