instant501
instant501

Reputation: 345

golangci-lint gives unseen errors after reinstalling

I upgraded the version of go to go1.18.3, following the instruction on https://go.dev/doc/install:

rm -rf /usr/local/go && tar -C /usr/local -xzf go1.18.3.linux-amd64.tar.gz
export PATH=$PATH:/usr/local/go/bin

Then I tried to run a Makefile for my go project but was prompted that golangci-lint was not installed. I assume that this was due to rm -rf /usr/local/go and all the packages were removed, or I somehow messed up with the files during the upgrade. I went on to install golangci-lint:

go install github.com/golangci/golangci-lint/cmd/[email protected]

A lot of previously unseen errors were reported. Like

could not import math/bits (-: could not load export data: cannot import "math/bits" (unknown iexport format version 2), export data is newer version - update tool)'

undeclared name: `yaml

...

I'm quite confused because the project used to compile successfully after lint checks. Should I downgrade gplangci-lint?

Upvotes: 6

Views: 4171

Answers (1)

Vincent Willats
Vincent Willats

Reputation: 28

go install Will install golangci-lint into your go/bin path. And that is previous where it lived and you are correct that rm -rf /usr/local/go would have remove it.

As for the newly reported errors, every update of golangci-lint will bring in more rules and linters. You can either downgrade, fix the errors or configure golangci-lint to your preferences https://golangci-lint.run/usage/configuration/

Upvotes: 0

Related Questions