Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

Please make sure no syntax or config error, then run 'go mod tidy' to ensure deps ok #157

Open
lqxhub opened this issue Jan 23, 2024 · 13 comments

Comments

@lqxhub
Copy link

lqxhub commented Jan 23, 2024

my computer (win10) have two versions go program, go 1.17.13 and go 1.20.8

in My project A,

goland use go 1.17.13 , But the environment variable GOPATH of the computer is set to go 1.20.8

image

This error is then displayed in goland Please make sure no syntax or config error, then run 'go mod tidy' to ensure deps ok

When I changed my computer's environment variables to match goland (go 1.17.13), there were no errors

go linter plugin version: 1.6.6

@xxpxxxxp
Copy link
Owner

Hi @lqxhub , please locate the error log by clicking in IDE Help -> Show log in xxx -> Open the log and search for go-linter -> if any error please paste it here. I need the verbose output to debug this issue, thanks. You can erase any sensitive path in the log.

@lqxhub
Copy link
Author

lqxhub commented Jan 24, 2024

@xxpxxxxp thanks for your reply

below is the log

D:\PROJECT is project path, in this project i did not use go mod, set project GOPAHT in goland

2024-01-24 09:22:57,358 [  31106]   WARN - go-linter - Run error: level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\battle.go:8:2: could not import container/list (-: could not load export data: no export data for \"container/list\")"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\battle.go:245:97: battle.Report.ProtoSize undefined (type *Report has no field or method ProtoSize)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\battle.go:246:55: battle.Report.ProtoSize undefined (type *Report has no field or method ProtoSize)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\battle_insert_action.go:59:24: battle.Report.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\battle_insert_action.go:60:27: battle.Report.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\battle_insert_action.go:62:28: battle.Report.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\battle_insert_action.go:64:30: battle.Report.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:34:33: this.Statistics undefined (type *Report has no field or method Statistics, but does have statistics)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:44:14: this.Result undefined (type *Report has no field or method Result)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:44:58: this.Result undefined (type *Report has no field or method Result)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:46:15: this.GetIsWin undefined (type *Report has no field or method GetIsWin)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:50:33: this.Statistics undefined (type *Report has no field or method Statistics, but does have statistics)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:150:11: r.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:153:31: r.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:153:4: r.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:166:11: r.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:169:11: r.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:172:13: r.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:172:35: r.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:193:11: r.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:196:11: r.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:199:13: r.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:199:35: r.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:257:11: r.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:260:11: r.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:264:15: r.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:264:37: r.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:354:11: r.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:359:8: r.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:360:6: r.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:362:13: r.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:364:12: r.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:367:8: r.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:367:30: r.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:368:6: r.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:368:28: r.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:370:13: r.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:370:35: r.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:372:12: r.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:375:8: r.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:375:30: r.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:376:6: r.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:376:28: r.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:378:13: r.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:378:35: r.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:518:15: r.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:518:37: r.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:578:7: r.Result undefined (type *Report has no field or method Result)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:602:5: r.IsWin undefined (type *Report has no field or method IsWin)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:604:4: r.Result undefined (type *Report has no field or method Result)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:611:27: r.Statistics undefined (type *Report has no field or method Statistics, but does have statistics)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:611:5: r.Statistics undefined (type *Report has no field or method Statistics, but does have statistics)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:625:25: r.OwnTeams undefined (type *Report has no field or method OwnTeams)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:635:25: r.OwnTeams undefined (type *Report has no field or method OwnTeams)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:645:15: r.Result undefined (type *Report has no field or method Result)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:650:15: r.Result undefined (type *Report has no field or method Result)"
level=warning msg="[runner] Can't run linter goanalysis_metalinter: inspect: failed to load package common: could not load export data: no export data for \"base/common\""
level=error msg="Running error: 1 error occurred:\n\t* can't run linter goanalysis_metalinter: inspect: failed to load package common: could not load export data: no export data for \"base/common\"\n\n"
. Please make sure the project has no syntax error.
2024-01-24 09:22:57,361 [  31109]   WARN - go-linter - Debug command: cd "D:\PROJECT" && set PATH="D:\go\bin;D:\python3.9.1;E:\goProject\bin;E:\mingw64_13.2\bin;D:\Applications\go1.20.8\bin;C:\Users\MYNAME\go\bin; ...omit some environment variables... " && set GOPATH="D:POROJECT" && set GO111MODULE="off" && E:\goProject\bin\golangci-lint.exe "run" "--out-format" "json" "--allow-parallel-runners" "-j" "2" "--issues-exit-code" "1" "--max-issues-per-linter" "0" "--max-same-issues" "0" "-c" "D:\PROJECT\.golangci.yml" "src\battle"
2024-01-24 09:23:09,761 [  43509]   INFO - #c.i.w.i.i.j.s.JpsGlobalModelSynchronizerImpl - Saving global entities to files
2024-01-24 09:23:11,630 [  45378]   INFO - #c.i.o.a.i.PopupMenuPreloader - 4925 ms since showing to preload popup menu 'Editor Popup Menu' at 'EditorPopup(preload-bgt)' in 27 ms
2024-01-24 09:23:11,631 [  45379]   INFO - #c.i.o.a.i.PopupMenuPreloader - 4932 ms since showing to preload popup menu 'Editor Popup Menu' at 'EditorPopup(preload-bgt)' in 28 ms

@xxpxxxxp
Copy link
Owner

Thank you, the log really helps!
From log I see you have go 1.17.13 in D:\go and 1.20.8 in D:\Applications\go1.20.8\bin
In the debug command there's a suspicious point: set GOPATH="D:POROJECT". I guess you didn't delete a \ intentionally?

@xxpxxxxp
Copy link
Owner

Would you help run the debug command, once the original command, once corrects the \ in GOPATH, to see if any of them work correctly.

@lqxhub
Copy link
Author

lqxhub commented Jan 24, 2024

Thank you, the log really helps! From log I see you have go 1.17.13 in D:\go and 1.20.8 in D:\Applications\go1.20.8\bin In the debug command there's a suspicious point: set GOPATH="D:POROJECT". I guess you didn't delete a \ intentionally?

I am very sorry, I accidentally made a mistake when substituting. The real log is set GOPATH= 'D:\POROJECT

@lqxhub
Copy link
Author

lqxhub commented Jan 24, 2024

screenshot:

image

@xxpxxxxp
Copy link
Owner

OK, no worries. Would you help to run the debug command in your terminal, see if that succeed or print the same error above?

@lqxhub
Copy link
Author

lqxhub commented Jan 25, 2024

When I execute this command in windows cmd
cd "D:\PROJECT" && set GOPATH="D:\PROJECT" && set GO111MODULE="off" && E:\goProject\bin\golangci-lint.exe "run" "--out-format" "json" "--allow-parallel-runners" "-j" "2" "--issues-exit-code" "1" "--max-issues-per-linter" "0" "--max-same-issues" "0" "-c" "D:\PROJECT\.golangci.yml" "src\battle"

result is:

level=warning msg="Failed to discover go env: failed to run 'go env': exit status 1"
level=error msg="Running error: context loading failed: failed to load packages: failed to load with go/packages: err: exit status 1: stderr: go: unknown environment setting GO111MODULE=\"off\" \n"

I delete set GO111MODULE="off" and with new cmd session execute again

The result seems to be the same as before

level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\battle.go:245:97: battle.Report.ProtoSize undefined (type *Report has no field or method ProtoSize)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\battle.go:246:55: battle.Report.ProtoSize undefined (type *Report has no field or method ProtoSize)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\battle_insert_action.go:59:24: battle.Report.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\battle_insert_action.go:60:27: battle.Report.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\battle_insert_action.go:62:28: battle.Report.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\battle_insert_action.go:64:30: battle.Report.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:34:33: this.Statistics undefined (type *Report has no field or method Statistics, but does have statistics)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:44:14: this.Result undefined (type *Report has no field or method Result)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:44:58: this.Result undefined (type *Report has no field or method Result)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:46:15: this.GetIsWin undefined (type *Report has no field or method GetIsWin)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:50:33: this.Statistics undefined (type *Report has no field or method Statistics, but does have statistics)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:150:11: r.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:153:31: r.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:153:4: r.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:166:11: r.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:169:11: r.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:172:13: r.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:172:35: r.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:193:11: r.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:196:11: r.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:199:13: r.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:199:35: r.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:257:11: r.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:260:11: r.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:264:15: r.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:264:37: r.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:354:11: r.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:359:8: r.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:360:6: r.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:362:13: r.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:364:12: r.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:367:8: r.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:367:30: r.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:368:6: r.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:368:28: r.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:370:13: r.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:370:35: r.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:372:12: r.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:375:8: r.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:375:30: r.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:376:6: r.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:376:28: r.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:378:13: r.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:378:35: r.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:518:15: r.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:518:37: r.Bouts undefined (type *Report has no field or method Bouts)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:578:7: r.Result undefined (type *Report has no field or method Result)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:602:5: r.IsWin undefined (type *Report has no field or method IsWin)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:604:4: r.Result undefined (type *Report has no field or method Result)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:611:27: r.Statistics undefined (type *Report has no field or method Statistics, but does have statistics)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:611:5: r.Statistics undefined (type *Report has no field or method Statistics, but does have statistics)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:625:25: r.OwnTeams undefined (type *Report has no field or method OwnTeams)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:635:25: r.OwnTeams undefined (type *Report has no field or method OwnTeams)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:645:15: r.Result undefined (type *Report has no field or method Result)"
level=error msg="[linters_context] typechecking error: D:\\PROJECT\\src\\battle\\report.go:650:15: r.Result undefined (type *Report has no field or method Result)"
level=warning msg="[runner] Can't run linter goanalysis_metalinter: inspect: failed to load package : could not load export data: no export data for \"base/common\""
level=error msg="Running error: 1 error occurred:\n\t* can't run linter goanalysis_metalinter: inspect: failed to load package : could not load export data: no export data for \"base/common\"\n\n"

@lqxhub
Copy link
Author

lqxhub commented Jan 25, 2024

2024-01-24 09:22:57,361 [ 31109] WARN - go-linter - Debug command: cd "D:\PROJECT" && set PATH="D:\go\bin;D:\python3.9.1;E:\goProject\bin;E:\mingw64_13.2\bin;D:\Applications\go1.20.8\bin;C:\Users\MYNAME\go\bin; ...omit some environment variables... " && set GOPATH="D:POROJECT" && set GO111MODULE="off" && E:\goProject\bin\golangci-lint.exe "run" "--out-format" "json" "--allow-parallel-runners" "-j" "2" "--issues-exit-code" "1" "--max-issues-per-linter" "0" "--max-same-issues" "0" "-c" "D:\PROJECT\.golangci.yml" "src\battle"

in the cmd, The PATH environment variable is overwritten before golangci-lint.exe is executed

set PATH="D:\go\bin; .....

But on my computer, after rewriting the path, the go program message was not found

image

@lqxhub
Copy link
Author

lqxhub commented Jan 25, 2024

2024-01-24 09:22:57,361 [ 31109] WARN - go-linter - Debug command: cd "D:\PROJECT" && set PATH="D:\go\bin;D:\python3.9.1;E:\goProject\bin;E:\mingw64_13.2\bin;D:\Applications\go1.20.8\bin;C:\Users\MYNAME\go\bin; ...omit some environment variables... " && set GOPATH="D:POROJECT" && set GO111MODULE="off" && E:\goProject\bin\golangci-lint.exe "run" "--out-format" "json" "--allow-parallel-runners" "-j" "2" "--issues-exit-code" "1" "--max-issues-per-linter" "0" "--max-same-issues" "0" "-c" "D:\PROJECT\.golangci.yml" "src\battle"

in the cmd, The PATH environment variable is overwritten before golangci-lint.exe is executed

set PATH="D:\go\bin; .....

But on my computer, after rewriting the path, the go program message was not found

image

set path This problem is already known, is the problem of ""

I use the script:

@echo off

cd D:\PROJECT
set GOPATH=D:\PROJECT

E:\goProject\bin\golangci-lint.exe run --out-format json --allow-parallel-runners -j 2 --issues-exit-code 1 --max-issues-per-linter 0 --max-same-issues 0 -c D:\PROJECT\.golangci.yml src\battle

@pause

result is OK,

Let me keep trying to figure out what went wrong

@lqxhub
Copy link
Author

lqxhub commented Jan 25, 2024

I use the script:

@echo off

set GO111MODULE=off

set PATH=D:\go\bin;...

set GOROOT=D:\go

go env

cd D:\PROJECT
set GOPATH=D:\PROJECT

E:\goProject\bin\golangci-lint.exe run --out-format json --allow-parallel-runners -j 2 --issues-exit-code 1 --max-issues-per-linter 0 --max-same-issues 0 -c D:\PROJECT\.golangci.yml src\battle

@pause

result is OK

Unlike cmd in the previous log, I set GOROOT

So I feel like I didn't set up GOROOT before

When there are multiple go programs in the path, the GOROOT environment variable needs to be set

@xxpxxxxp
Copy link
Owner

wow, that's a lot of investigation, thanks!
Let me explain a few behaviors:

  • D:\go\bin is added to the HEAD of PATH by plugin, to ensure in case when user has multiple go environments in system (like you do), the one that set in GoLand takes precedence
  • set GO111MODULE="off" I'm not sure why this doesn't work, the flag is supported starting from Go 1.11. The plugin set the value to "off" when the project is using legacy GOPATH deps instead of Go modules.
  • GOROOT by default it should be deducted from the current go binary path, I don't know why it doesn't work. While this could be an easy fix for the plugin, I'll just pass thru the IDE's GOROOT to cmd arguments (will be fixed soon).

@lqxhub
Copy link
Author

lqxhub commented Jan 26, 2024

this is so cool

Thank you very much for your answer, and thank you very much for providing this plugin

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants