Skip to content

golangci-lint "DecodeRune not declared by package utf8" with golang 1.13 #658

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

Closed
ialidzhikov opened this issue Sep 3, 2019 · 17 comments
Closed

Comments

@ialidzhikov
Copy link

ialidzhikov commented Sep 3, 2019

Please include the following information:

  1. Version of golangci-lint: golangci-lint --version (or git commit if you don't use binary distribution)
$ golangci-lint --version
golangci-lint has version 1.17.1 built from 4ba2155 on 2019-06-10T09:07:35Z
  1. Config file: cat .golangci.yml - none

  2. Go environment: go version && go env

$ go version
go version go1.13 darwin/amd64

$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/foo/Library/Caches/go-build"
GOENV="/Users/foo/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/foo/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/foo/go/src/github.com/gardener/gardener-extensions/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/p9/6dr9snnx6ws1dxkj4b66st6r0000gn/T/go-build176963248=/tmp/go-build -gno-record-gcc-switches -fno-common"
  1. Verbose output of running: golangci-lint run -v
$ golangci-lint run ./...

foo.go:1: /usr/local/go/src/regexp/regexp.go:967:22: DecodeRuneInString not declared by package utf8 (typecheck)
bar.go:1: /usr/local/go/src/mime/encodedword.go:130:22: DecodeRuneInString not declared by package utf8 (typecheck)
baz.go:1: /usr/local/go/src/go/token/token.go:317:16: DecodeRuneInString not declared by package utf8
@twpayne
Copy link
Contributor

twpayne commented Sep 3, 2019

FYI same issue here, but affecting multiple functions not declared by package utf8 (typecheck):

  • DecodeRune
  • DecodeRuneInString
  • ValidString

@stevenh
Copy link

stevenh commented Sep 4, 2019

If you rebuild with golang 1.13 it seem to work after that.

@ialidzhikov
Copy link
Author

/cc @jirfag

@psampaz
Copy link

psampaz commented Sep 4, 2019

Exactly the same issue for me

@korvinko
Copy link

korvinko commented Sep 4, 2019

Temp workaround for me:

.golangci.yml

issues:
  exclude:
    - "not declared by package utf8"
    - "unicode/utf8/utf8.go"

@twpayne
Copy link
Contributor

twpayne commented Sep 4, 2019

Thanks, to explain what seems to be going on here:

golangci-lint, built with Go 1.12, will generate this error when linting Go 1.13 code.

If you're using a pre-built binary of golangci-lint then you'll run in to this error.

As @stevenh said, rebuilding golangci-lint fixes the error. Specifically, if you're currently following the golangci-lint install instructions (which downloads a pre-built binary from GitHub) then this will not work with Go 1.13. You'll have to install golangci-lint from source instead (at least until golangci-lint releases a version built with Go 1.13).

If you're installing golangci-lint with:

curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh

Use this instead:

GO111MODULE=off go get -u github.com/golangci/golangci-lint/cmd/golangci-lint

@cloudlena
Copy link

cloudlena commented Sep 6, 2019

So I guess what we need is just another release on GoReleaser built with Go 1.13. Using GO111MODULE=off go get -u github.com/golangci/golangci-lint/cmd/golangci-lint certainly works but AFAIK will alaways get the latest master instead of a released version which, in most cases, is not desirable.

@erikdubbelboer
Copy link

But just building golangci-lint with Go 1.13 doesn't seem to fix the underlying issue. It's not like DecodeRune changed since 1.13 so there must be something internally in golangci-lint that goes wrong and might also go wrong for other packages?

hugoArregui pushed a commit to pion/ice that referenced this issue Sep 6, 2019
hugoArregui pushed a commit to pion/ice that referenced this issue Sep 6, 2019
@rkuska
Copy link

rkuska commented Sep 6, 2019

But just building golangci-lint with Go 1.13 doesn't seem to fix the underlying issue. It's not like DecodeRune changed since 1.13 so there must be something internally in golangci-lint that goes wrong and might also go wrong for other packages?

I believe it is because Go 1.13 added binary integer literals and they are being used in the standard library but Go 1.12 doesn't recognize them thus can't really build the module and as such DecodeRune is not being reported as available by runtime.

Does it make sense?

Sean-Der pushed a commit to pion/ice that referenced this issue Sep 7, 2019
@piepmatz
Copy link

piepmatz commented Sep 9, 2019

While

GO111MODULE=off go get -u github.com/golangci/golangci-lint/cmd/golangci-lint

is a valid workaround, it builds the master branch.

To get the latest release instead, use

GO111MODULE=off go get gopkg.in/golangci/golangci-lint.v1/cmd/golangci-lint

@rkuska
Copy link

rkuska commented Sep 9, 2019

To get the latest release instead, use

GO111MODULE=off go get gopkg.in/golangci/golangci-lint.v1/cmd/golangci-lint

I would expect this to pull the latest tagged version for major version 1 and instead it pulled master for me; have CI now failing on funLen linter which was just merged to master.

@rkuska
Copy link

rkuska commented Sep 9, 2019

And to make matters worse I can't install the specific version via go modules because from go-1.13 point of view the mod file is corrupted (fix is already in master). Vicious circle :D

@jirfag
Copy link
Contributor

jirfag commented Sep 10, 2019

Hi! sorry for the slow response.
I've published the 1.18.0 release. Please, check that everything works

ccamel added a commit to ccamel/kynaptik that referenced this issue Sep 10, 2019
This resolves issue golangci/golangci-lint#658 when compiling with go1.13.
@stevenh
Copy link

stevenh commented Sep 10, 2019

Thanks for the update to 1.18.0 @jirfag but this still panics for us in bodyclose as captured here so still unable to use:
#622
#608

@ialidzhikov
Copy link
Author

ialidzhikov commented Sep 10, 2019

My issue is resolved with 1.18.0 release. Please update your golangci-lint:

$ curl -sfL "https://install.goreleaser.com/github.com/golangci/golangci-lint.sh" | sh -s -- -b $(go env GOPATH)/bin v1.18.0

Thank you @jirfag !

@joeblubaugh
Copy link

This issue was not resolved for me by the 1.18.0 release.

foxcpp added a commit to foxcpp/go-jmap that referenced this issue Sep 10, 2019
foxcpp added a commit to foxcpp/go-assuan that referenced this issue Sep 10, 2019
baijum added a commit to baijum/service-binding-operator that referenced this issue Oct 10, 2019
openshift-merge-robot pushed a commit to redhat-developer/service-binding-operator that referenced this issue Oct 10, 2019
hamiltont added a commit to hamiltont/systemd_exporter that referenced this issue Jan 31, 2020
See golangci/golangci-lint#658 for details

Summary - golangci-lint, built with Go 1.12, will generate this error when linting Go 1.13 code
vrothberg added a commit to vrothberg/libpod that referenced this issue Feb 5, 2020
Fixes: golangci/golangci-lint#658
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
mbyczkowski added a commit to square/go-jose that referenced this issue Mar 8, 2020
- Test against supported Go versions (Go 1.13 and 1.14), which also
  means we don't need GO111MODULE anymore
- Remove old options like 'sudo: false'
- Bump golangci-lint to 1.18.0, so it works with Go 1.13+ (see
  golangci/golangci-lint#658 for details)
mbyczkowski added a commit to square/go-jose that referenced this issue Mar 8, 2020
- Test against supported Go versions (Go 1.13 and 1.14), which also
  means we don't need GO111MODULE anymore
- Remove old options like 'sudo: false'
- Bump golangci-lint to 1.18.0, so it works with Go 1.13+ (see
  golangci/golangci-lint#658 for details)
skitt added a commit to skitt/submariner that referenced this issue Mar 17, 2020
This requires upgrading to golangci-lint 1.18 to fix
golangci/golangci-lint#658 with Go 1.13.

Signed-off-by: Stephen Kitt <skitt@redhat.com>
skitt added a commit to skitt/submariner that referenced this issue Mar 17, 2020
This requires upgrading to golangci-lint 1.18 to fix
golangci/golangci-lint#658 with Go 1.13.

Signed-off-by: Stephen Kitt <skitt@redhat.com>
skitt added a commit to skitt/submariner that referenced this issue Mar 18, 2020
This requires upgrading to golangci-lint 1.18 to fix
golangci/golangci-lint#658 with Go 1.13.

Signed-off-by: Stephen Kitt <skitt@redhat.com>
mangelajo pushed a commit to submariner-io/submariner that referenced this issue Mar 19, 2020
This requires upgrading to golangci-lint 1.18 to fix
golangci/golangci-lint#658 with Go 1.13.

Signed-off-by: Stephen Kitt <skitt@redhat.com>
skitt added a commit to skitt/shipyard that referenced this issue Mar 19, 2020
This requires upgrading to golangci-lint 1.18 to fix
golangci/golangci-lint#658 with Go 1.13.

Signed-off-by: Stephen Kitt <skitt@redhat.com>
tpantelis pushed a commit to submariner-io/shipyard that referenced this issue Mar 19, 2020
This requires upgrading to golangci-lint 1.18 to fix
golangci/golangci-lint#658 with Go 1.13.

Signed-off-by: Stephen Kitt <skitt@redhat.com>
rhcarvalho added a commit to getsentry/sentry-go that referenced this issue Jun 22, 2020
- Remove linter skip-dirs config, there is no reason to skip linting the
echo integration and example.

- Add whitespace linter. It checks for unnecessary newlines at the start
and end of functions, if, for, etc.

- Remove unnecessary linter exclude rule (was a golangci-lint bug,
golangci/golangci-lint#658)
mheon pushed a commit to mheon/libpod that referenced this issue Sep 16, 2020
Fixes: golangci/golangci-lint#658
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
taxonomic-blackfish added a commit to CircleCI-Public/circleci-cli that referenced this issue Jan 13, 2021
novad03 pushed a commit to novad03/k8s-submariner that referenced this issue Nov 25, 2023
This requires upgrading to golangci-lint 1.18 to fix
golangci/golangci-lint#658 with Go 1.13.

Signed-off-by: Stephen Kitt <skitt@redhat.com>
Tcrypto126 added a commit to Tcrypto126/Go-graphql that referenced this issue Feb 12, 2025
This resolves issue golangci/golangci-lint#658
when compiling with go1.13.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests