[英]Why doesn't linting in Github Actions work when it does locally?
I'm building a Go project, and i'm using Github actions on every checkin.我正在构建一个 Go 项目,并且在每次签入时都使用 Github 操作。
The project is here: https://github.com/filecoin-project/bacalhau项目在这里: https://github.com/filecoin-project/bacalhau
When I run the project locally, it runs fine - eg:当我在本地运行该项目时,它运行良好 - 例如:
❯ golangci-lint run
❯
But when I do the same command in Github Actions, I get warnings like I haven't vendored in the modules correctly (guessing).但是当我在 Github 操作中执行相同的命令时,我收到警告,就像我没有正确地在模块中销售(猜测)。
Error: undeclared name: `libp2p` (typecheck)
Error: undeclared name: `libp2p` (typecheck)
Error: undeclared name: `libp2p` (typecheck)
Error: "github.com/libp2p/go-libp2p" imported but not used (typecheck)
Error: issues found
Even when I remove the linting, I get similar problems (it doesn't build properly - eg https://github.com/filecoin-project/bacalhau/runs/5313987141?check_suite_focus=true即使我删除了 linting,我也会遇到类似的问题(它没有正确构建 - 例如https://github.com/filecoin-project/bacalhau/runs/5313987141?check_suite_focus=true
The ONE time I logged in myself, via ssh, and executed the build manually (eg go build
) it failed with the same error, but this was solveable by just doing go mod vendor
, go mod tidy
inline.有一次我自己通过ssh登录并手动执行构建(例如
go build
),它失败并出现相同的错误,但这可以通过仅执行go mod vendor
和go mod tidy
inline 来解决。 HOWEVER, this shouldn't be necessary, right?然而,这不应该是必要的,对吧? Because I've checked in a vendor directory?
因为我已经签入了供应商目录?
What am I missing?我错过了什么? Thanks!
谢谢!
I solved this by blowing away everything in my /vendor dir, and.gitignoring it.我通过清除 /vendor 目录中的所有内容并忽略它来解决这个问题。 This forced GitHub actions to redownload everything.
这迫使 GitHub 操作重新下载所有内容。 Not sure if this was the most efficient solution, but worked for me!
不确定这是否是最有效的解决方案,但对我有用!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.