Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

typecheck: possible wrong cut #1873

Closed
3 of 4 tasks
ldez opened this issue Mar 27, 2021 · 8 comments
Closed
3 of 4 tasks

typecheck: possible wrong cut #1873

ldez opened this issue Mar 27, 2021 · 8 comments
Labels
question Further information is requested

Comments

@ldez
Copy link
Member

ldez commented Mar 27, 2021

  • Yes, I'm using a binary release within 2 latest major releases. Only such installations are supported.
  • Yes, I've searched similar issues on GitHub and didn't find any.
  • Yes, I've included all information below (version, config, etc).
  • Yes, I've tried with the standalone linter if available. (https://golangci-lint.run/usage/linters/)

#1861 (comment)

Description of the problem

Your description

Version of golangci-lint
$ golangci-lint --version
golangci-lint has version 1.39.0 built from 9aea4aee on 2021-03-26T08:02:53Z
Config file
$ cat .golangci.yml
# paste output here
Go environment
$ go version && go env
# paste output here
Verbose output of running
$ golangci-lint cache clean
$ golangci-lint run -v
# paste output here
Code example or link to a public repository
// add your code here
@ldez ldez added the bug Something isn't working label Mar 27, 2021
@ldez
Copy link
Member Author

ldez commented Mar 27, 2021

@thebeline could you provide the information to fill the issue?

  • Config file
  • Verbose output of running
  • Go environment
  • example or a public repository

@ldez ldez changed the title tyepcheck: possible wrong cut typecheck: possible wrong cut Mar 27, 2021
@ldez
Copy link
Member Author

ldez commented Mar 27, 2021

@thebeline I think that your problem is related to something else:

  • are you using go1.16?
  • are you using go modules?

@ldez ldez added question Further information is requested and removed bug Something isn't working labels Mar 27, 2021
@ldez
Copy link
Member Author

ldez commented Mar 27, 2021

@thebeline
Copy link

@ldez - Certainly. I need to draft up an MVP for the issue. But below I will try to describe the steps as I can remember.

  • Hardware: Raspberry Pi 3 B
  • OS: OctoPi (Debian BUSTER)
  • Go Package Checkout
    • Clone https://github.com/thebeline/OctoScreen.git into /home/pi/OctoPrint
    • Checkout IMP/GolangLinter
  • Golang Setup
    • Raspbian (or, at least OctoPi) ships with an old Go (1.11, I believe)
    • We want Golang 1.15.10, as 1.16.0 behaves oddly with the version of gotk3 we are using.
    • Remove Golang if installed.
    • Install Golang 1.15.10
      • $ wget https://golang.org/dl/go1.15.10.linux-armv6l.tar.gz
      • $ sudo tar -C /usr/local -xzf go1.15.10.linux-armv6l.tar.gz
    • Install GolangCI-Lint
      • curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.39.0
    • Install the build dependencies (not all are needed, but this was in my history, I think only GTK and Cairo are needed)
      • sudo apt-get update && sudo apt-get install -y --no-install-recommends build-essential git-buildpackage fakeroot libcairo2-dev libgtk-3-dev git devscripts
    • Preconfigure some build flags (GTK 2.24 is bugged as of January, flag for 2.22)
      • $ go env -w GOFLAGS=-tags=gtk_3_22,pango_1_42,gdk_pixbuf_2_38,glib_2_58
  • Run golangci-lint
    • $ /home/pi/go/bin/golangci-lint run --new=false --issues-exit-code 0 -v --modules-download-mode vendor

There are probably some red flags in there, but note that it does run in GitHubActions.

Verbose Output HEAD (errors as described follow):

/home/pi/go/bin/golangci-lint run --new=false --new-from-rev= --issues-exit-code 0 -vvv --modules-download-mode vendor
INFO [config_reader] Config search paths: [./ /home/pi/OctoScreen /home/pi /home /]
INFO [config_reader] Used config file .golangci.yml
INFO [lintersdb] Active 9 linters: [dogsled errorlint gofumpt makezero nolintlint unparam unused whitespace wsl]
INFO [loader] Go packages loading at mode 575 (imports|types_sizes|compiled_files|deps|files|exports_file|name) took 1.942055235s
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 56.589407ms
INFO [linters context/goanalysis] analyzers took 4.629646ms with top 10 stages: errorlint: 2.578153ms, buildir: 364.737µs, whitespace: 327.289µs, makezero: 219.216µs, gofumpt: 205.726µs, the_only_name: 185.988µs, dogsled: 156.249µs, nolintlint: 143.54µs, buildssa: 136.404µs, isgenerated: 95.729µs
INFO [runner] Processors filtering stat (out/in): max_per_file_from_linter: 2220/2220, path_prefixer: 2220/2220, nolint: 2220/2220, path_prettifier: 2220/2220, exclude: 2220/2220, exclude-rules: 2220/2220, diff: 2220/2220, max_same_issues: 2220/2220, source_code: 2220/2220, path_shortener: 2220/2220, filename_unadjuster: 2220/2220, severity-rules: 2220/2220, identifier_marker: 2220/2220, uniq_by_line: 2220/2220, max_from_linter: 2220/2220, skip_files: 2220/2220, skip_dirs: 2220/2220, autogenerated_exclude: 2220/2220, sort_results: 2220/2220, cgo: 2220/2220
INFO [runner] processing took 580.551429ms with stages: identifier_marker: 275.213929ms, exclude-rules: 224.839465ms, nolint: 45.997165ms, source_code: 11.651398ms, path_prettifier: 9.721106ms, sort_results: 5.710415ms, path_shortener: 2.261071ms, filename_unadjuster: 1.245666ms, cgo: 1.150563ms, severity-rules: 1.018845ms, max_per_file_from_linter: 932.7µs, autogenerated_exclude: 788.691µs, max_same_issues: 5.625µs, uniq_by_line: 2.448µs, exclude: 2.448µs, skip_files: 2.135µs, path_prefixer: 2.083µs, skip_dirs: 2.083µs, max_from_linter: 1.876µs, diff: 1.717µs
INFO [runner] linters took 11.045904951s with stages: goanalysis_metalinter: 10.464684572s

After alll of this, I think I should clarify: Locally, I know this error is caused because gccgo is not installed.

That is my mistake.

What I am actually raising as an issue:

  • Like I said in my previous comment, I think converting this condition to a "linter error" hides underlying issues (that I would have seen much more clearly in 1.38)
  • This triggers LINTER_COUNT+1 times.
    • If it is known that this error state will prevent a linter from continuing, maybe don't continue (although I know that is probably difficult to predict)
    • "Unique by line and character" seems like it would be helpful, just in general.
  • By and large, it would seem that if golangci-lint were able to detect catastrophic environment issues (such as cgo preprocessing failed, or failing to load basic go standard libraries), there have to be more helpful debug messages.

MESS/GolangLinter can be ignored for now, but yes, IMP/GolangLinter was where I was working.

@thebeline
Copy link

With regards to the IMP/GolangLinter branch, please note that the majority of those commits were just seeing how things behaved.

One thing that I was looking at was related to: https://github.com/golangci/golangci-lint-action/issues/192

Which, as I go down the rabbit hole, I now realize has nothing to do with the action, but moreso with linter it's self.

Actually, I have never run the linter locally, which is why I hadn't seen this issue until now. I only just started trying to run it locally because I was going to try poking things to figure out how the linter worked, and why exactly it was behaving as I had mentioned in the Action Issue I opened.

@ldez
Copy link
Member Author

ldez commented Mar 27, 2021

Your problem in golangci/golangci-lint-action#192 is related to #1490, it's not related to the github action

@thebeline
Copy link

Ah, it would seem, more specifically: #1490 (comment)

A function like mergeLineIssues seems like it might have something to do with things I mentioned. :-)

Still, it seems odd that if golangci-lint, under the hood, knows that the env is broken, why does it keep going?

@ldez
Copy link
Member Author

ldez commented Mar 27, 2021

golangci-lint doesn't know if the env is broken, golangci-lint just run Go analysis and run the linters.
It just displays the report from Go analysis: each linter has differents requirements and the fact to compile is not required by all the linters.

@ldez ldez closed this as completed Mar 27, 2021
@golangci golangci locked and limited conversation to collaborators Mar 27, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants