简体   繁体   中英

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.

The project is here: 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).

  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

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. 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. This forced GitHub actions to redownload everything. Not sure if this was the most efficient solution, but worked for me!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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