-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ERRO Running error: context loading failed: failed to load program with go/packages #395
Comments
hi, thank you for reporting! |
yes, it's dependency, and I probably know the reason. thx for your reply. |
in my case (on jenkins), it solved my problem:
|
Feel I've just hit the same blocker. My program uses modules, so the I'm first running
Sources are in https://github.com/andig/mbmd/tree/rename. |
may i know fix/workaround to resolve the issue ? |
you need just to install all dependencies |
Sorry to comment on a closed issue but how to make golangci-lint work with Go Modules? I had to manually install all the dependencies ( Is there anything I'm missing here? A possible solution, I guess, would be to disable Go Modules, |
@tsauvajon Have you tried this? run:
modules-download-mode: vendor |
Same via command line: |
Adding a
which was a useful error as two files were importing each other |
It's failing without flag
and it's failing with multiples errors when flag added multiple (per each modules which is listed in
|
#1466 might be related to this one. As a side note, notice the |
I stopped getting this error after turning on Go Modules like so: Also maybe relevant is that |
I am facing the same error does anyone have any solution?Also tried |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
The answer is simple. First
And then
In my case, it worked. |
For those who might face this issue: if you use it in GithHub Actions with some of your dependencies located in private repositories |
If you get this error only in pipelines then insure your go.sum file for your project is tracked and up to date in remote. |
Faced the same problem, but fixed:
|
After looking around for a while, this is what finally fixed a similar issue for me. Any idea what the underlying issue might be? |
This comment was marked as off-topic.
This comment was marked as off-topic.
It's not really clear from any of these posts how to solve it if you are using Github actions. Basically you need to add the env var already posted into the jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: '1.20'
cache: false
# Add these 2 lines below
env:
GO111MODULE: off
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.54
|
Just in case this is helpful for somebody else: verify that you have a |
One other thing you can look out for. In my case, I found the issue was actually in my go setup. I wasn't quoting the go version to be installed, so somehow it was being parsed as requesting go 1.2. This older version obviously was not happy with go modules. - uses: actions/setup-go@v5
with:
go-version: 1.20 Worked after changing to: - uses: actions/setup-go@v5
with:
go-version: '1.20' |
I'm not sure what's up, but i was facing this as well. First, I was able to get it working using the CLI only: golangci-lint run -v --show-stats --no-config --modules-download-mode readonly Like I said, that worked -- but I wanted to use a config file, so I tried: run:
modules-download-mode: readonly
output:
show-stats: true Invoked via: golangci-lint run --config ./.golangci.yml And that failed with the error from the OP. I'm sure there's some difference between |
golangci-lint --version
(or git commit if you don't use binary distribution)golangci-lint has version 1.14.0 built from 6c4d290 on 2019-02-11T06:59:20Z
cat .golangci.yml
go version && go env
golangci-lint run -v
The text was updated successfully, but these errors were encountered: