reviewdog / action-golangci-lint

Run golangci-lint with reviewdog

Home Page:https://github.com/marketplace?type=actions&query=reviewdog

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Problems with typecheck after release v1.20.0

lzakharov opened this issue · comments

I got this messages with go 1.16 after the new release v1.20.0:

  • ReadFile not declared by package os (typecheck)
  • ReadAll not declared by package io (typecheck)

Running golangci-lint locally works fine. Do I have to set go version somewhere explicitly to fix this problem?

You need to configure the GOROOT environment correctly.
golangci-lint looks up the standard libraries from GOROOT.
https://github.com/golangci/golangci-lint/blob/a833cc1600456c38357bb6f8abbd6f5aef7dbc51/pkg/lint/load.go#L54-L65

It looks that it points Go 1.15 by default on ubuntu-20.04.
So golangci-lint can't find the functions introduced from Go 1.16.
Using https://github.com/actions/setup-go is easiest way.

@shogo82148, many thanks! Now it works.