Skip to content

GH Action lints standard library #1101

@SchoolGuy

Description

@SchoolGuy

Welcome

  • Yes, I understand that the GitHub action repository is not the repository of golangci-lint itself.
  • Yes, I've searched similar issues on GitHub and didn't find any.
  • Yes, I've included all information below (version, config, etc).

Description of the problem

Locally when I run golangci-lint run I receive no errors but when the GH Action is running it shows several errors from outside of my code.

Running [/home/runner/golangci-lint-1.59.1-linux-amd64/golangci-lint run] in [/home/runner/work/cli/cli] ...
  Error: ../../../../../opt/hostedtoolcache/go/1.23.1/x64/src/slices/iter.go:50:17: cannot range over seq (variable of type iter.Seq[E]) (typecheck)
  	for v := range seq {
  	               ^
  Error: ../../../../../opt/hostedtoolcache/go/1.23.1/x64/src/maps/iter.go:51:20: cannot range over seq (variable of type iter.Seq2[K, V]) (typecheck)
  	for k, v := range seq {
  	                  ^
  Error: ../../../../../opt/hostedtoolcache/go/1.23.1/x64/src/os/stat_linux.go:47:57: not enough arguments in call to time.Unix
  	have (unknown type)
  	want (int64, int64) (typecheck)
  	return time.Unix(fi.Sys().(*syscall.Stat_t).Atim.Unix())
  	                                                       ^
  Error: ../../../go/pkg/mod/github.com/cobbler/cobblerclient@v0.4.4-0.20240912083620-338289090837/cobblerclient.go:371:15: undefined: mapstructure (typecheck)
  	var metadata mapstructure.Metadata
  	             ^
  Error: ../../../go/pkg/mod/github.com/cobbler/cobblerclient@v0.4.4-0.20240912083620-338289090837/cobblerclient.go:372:18: undefined: mapstructure (typecheck)
  	decoder, err := mapstructure.NewDecoder(&mapstructure.DecoderConfig{
  	                ^
  Error: ../../../go/pkg/mod/github.com/cobbler/cobblerclient@v0.4.4-0.20240912083620-338289090837/settings.go:176:15: undefined: mapstructure (typecheck)
  	var metadata mapstructure.Metadata
  	             ^
  Error: ../../../go/pkg/mod/github.com/kolo/xmlrpc@v0.0.0-20220921171641-a4b6fa1dd06b/decoder.go:43:7: dec.CharsetReader undefined (type *decoder has no field or method CharsetReader) (typecheck)
  		dec.CharsetReader = CharsetReader
  		    ^
  Error: ../../../go/pkg/mod/github.com/kolo/xmlrpc@v0.0.0-20220921171641-a4b6fa1dd06b/decoder.go:48:21: dec.Token undefined (type *decoder has no field or method Token) (typecheck)
  		if tok, err = dec.Token(); err != nil {
  		                  ^
  Error: ../../../go/pkg/mod/github.com/kolo/xmlrpc@v0.0.0-20220921171641-a4b6fa1dd06b/decoder.go:68:12: dec.Skip undefined (type *decoder has no field or method Skip) (typecheck)
  	err = dec.Skip()
  	          ^
  Error: ../../../go/pkg/mod/github.com/kolo/xmlrpc@v0.0.0-20220921171641-a4b6fa1dd06b/decoder.go:89:21: dec.Token undefined (type *decoder has no field or method Token) (typecheck)
  		if tok, err = dec.Token(); err != nil {
  		                  ^
  Error: ../../../go/pkg/mod/github.com/kolo/xmlrpc@v0.0.0-20220921171641-a4b6fa1dd06b/decoder.go:171:22: dec.Token undefined (type *decoder has no field or method Token) (typecheck)
  			if tok, err = dec.Token(); err != nil {
  			                  ^
  Error: ../../../go/pkg/mod/github.com/kolo/xmlrpc@v0.0.0-20220921171641-a4b6fa1dd06b/decoder.go:406:16: dec.Skip undefined (type *decoder has no field or method Skip) (typecheck)
  		if err = dec.Skip(); err != nil {
  		             ^
  Error: ../../../go/pkg/mod/github.com/kolo/xmlrpc@v0.0.0-20220921171641-a4b6fa1dd06b/decoder.go:231:3: slice declared and not used (typecheck)
  		slice := val
  		^
  Error: ../../../go/pkg/mod/github.com/kolo/xmlrpc@v0.0.0-20220921171641-a4b6fa1dd06b/decoder.go:435:26: dec.Skip undefined (type *decoder has no field or method Skip) (typecheck)
  	return name, value, dec.Skip()
  	                        ^
  Error: ../../../../../opt/hostedtoolcache/go/1.23.1/x64/src/net/http/fs.go:1000:20: missing type in composite literal (typecheck)
  		"Content-Range": {r.contentRange(size)},
  		                 ^
  Error: ../../../../../opt/hostedtoolcache/go/1.23.1/x64/src/net/http/fs.go:1001:20: missing type in composite literal (typecheck)
  		"Content-Type":  {contentType},
  		                 ^
  Error: ../../../../../opt/hostedtoolcache/go/1.23.1/x64/src/net/http/pattern.go:382:1: missing return (typecheck)
  }
  ^
  Error: ../../../../../opt/hostedtoolcache/go/1.23.1/x64/src/net/http/server.go:2210:1: missing return (typecheck)
  }
  ^
  Error: ../../../../../opt/hostedtoolcache/go/1.23.1/x64/src/math/big/intconv.go:220:21: r.ReadRune undefined (type byteReader has no field or method ReadRune) (typecheck)
  	ch, size, err := r.ReadRune()
  	                   ^
  Error: ../../../../../opt/hostedtoolcache/go/1.23.1/x64/src/math/big/intconv.go:228:11: r.UnreadRune undefined (type byteReader has no field or method UnreadRune) (typecheck)
  	return r.UnreadRune()
  	         ^
  Error: ../../../../../opt/hostedtoolcache/go/1.23.1/x64/src/crypto/tls/auth.go:133:7: previous case (typecheck)
  	case *rsa.PublicKey:
  	     ^
  Error: ../../../../../opt/hostedtoolcache/go/1.23.1/x64/src/crypto/tls/auth.go:181:7: previous case (typecheck)
  	case *ecdsa.PublicKey:
  	     ^
  Error: ../../../../../opt/hostedtoolcache/go/1.23.1/x64/src/crypto/tls/auth.go:273:7: previous case (typecheck)
  	case *ecdsa.PublicKey:
  	     ^
  Error: ../../../../../opt/hostedtoolcache/go/1.23.1/x64/src/crypto/tls/tls.go:15:2: "bytes" imported and not used (typecheck)
  	"bytes"
  	^
  Error: ../../../../../opt/hostedtoolcache/go/1.23.1/x64/src/html/template/escape.go:164:1: missing return (typecheck)
  }
  ^
  Error: ../../../../../opt/hostedtoolcache/go/1.23.1/x64/src/regexp/exec.go:432:48: inst.Arg undefined (type *onePassInst has no field or method Arg) (typecheck)
  	if pos == 0 && flag.match(syntax.EmptyOp(inst.Arg)) &&
  	                                              ^
  Error: ../../../../../opt/hostedtoolcache/go/1.23.1/x64/src/regexp/exec.go:446:17: inst.Out undefined (type *onePassInst has no field or method Out) (typecheck)
  		pc = int(inst.Out)
  		              ^
  Error: ../../../../../opt/hostedtoolcache/go/1.23.1/x64/src/regexp/exec.go:447:15: inst.Op undefined (type *onePassInst has no field or method Op) (typecheck)
  		switch inst.Op {
  		            ^
  Error: ../../../../../opt/hostedtoolcache/go/1.23.1/x64/src/regexp/exec.go:458:13: inst.MatchRune undefined (type *onePassInst has no field or method MatchRune) (typecheck)
  			if !inst.MatchRune(r) {
  			         ^
  Error: ../../../../../opt/hostedtoolcache/go/1.23.1/x64/src/regexp/exec.go:462:17: inst.Rune undefined (type *onePassInst has no field or method Rune) (typecheck)
  			if r != inst.Rune[0] {
  			             ^
  Error: ../../../../../opt/hostedtoolcache/go/1.23.1/x64/src/regexp/exec.go:480:39: inst.Arg undefined (type *onePassInst has no field or method Arg) (typecheck)
  			if !flag.match(syntax.EmptyOp(inst.Arg)) {
  			                                   ^
  Error: ../../../../../opt/hostedtoolcache/go/1.23.1/x64/src/regexp/exec.go:485:16: inst.Arg undefined (type *onePassInst has no field or method Arg) (typecheck)
  			if int(inst.Arg) < len(m.matchcap) {
  			            ^
  Error: ../../../../../opt/hostedtoolcache/go/1.23.1/x64/src/regexp/onepass.go:76:12: i.MatchRunePos undefined (type *onePassInst has no field or method MatchRunePos) (typecheck)
  	next := i.MatchRunePos(r)
  	          ^
  Error: ../../../../../opt/hostedtoolcache/go/1.23.1/x64/src/regexp/onepass.go:80:7: i.Op undefined (type *onePassInst has no field or method Op) (typecheck)
  	if i.Op == syntax.InstAltMatch {
  	     ^
  Error: ../../../../../opt/hostedtoolcache/go/1.23.1/x64/src/regexp/onepass.go:81:12: i.Out undefined (type *onePassInst has no field or method Out) (typecheck)
  		return i.Out
  		         ^
  Error: ../../../../../opt/hostedtoolcache/go/1.23.1/x64/src/regexp/onepass.go:238:21: p.Inst[pc].Op undefined (type onePassInst has no field or method Op) (typecheck)
  		switch p.Inst[pc].Op {
  		                  ^
  Error: ../../../../../opt/hostedtoolcache/go/1.23.1/x64/src/regexp/onepass.go:243:29: p.Inst[pc].Out undefined (type onePassInst has no field or method Out) (typecheck)
  			p_A_Other := &p.Inst[pc].Out
  			                         ^
  Error: ../../../../../opt/hostedtoolcache/go/1.23.1/x64/src/regexp/onepass.go:244:27: p.Inst[pc].Arg undefined (type onePassInst has no field or method Arg) (typecheck)
  			p_A_Alt := &p.Inst[pc].Arg
  			                       ^
  Error: ../../../../../opt/hostedtoolcache/go/1.23.1/x64/src/regexp/onepass.go:247:17: instAlt.Op undefined (type onePassInst has no field or method Op) (typecheck)
  			if !(instAlt.Op == syntax.InstAlt || instAlt.Op == syntax.InstAltMatch) {
  			             ^
  Error: ../../../../../opt/hostedtoolcache/go/1.23.1/x64/src/regexp/onepass.go:250:18: instAlt.Op undefined (type onePassInst has no field or method Op) (typecheck)
  				if !(instAlt.Op == syntax.InstAlt || instAlt.Op == syntax.InstAltMatch) {
  				             ^
  Error: ../../../../../opt/hostedtoolcache/go/1.23.1/x64/src/regexp/onepass.go:256:17: instOther.Op undefined (type onePassInst has no field or method Op) (typecheck)
  			if instOther.Op == syntax.InstAlt || instOther.Op == syntax.InstAltMatch {
  			             ^
  Error: ../../../../../opt/hostedtoolcache/go/1.23.1/x64/src/regexp/onepass.go:262:33: p.Inst[*p_A_Alt].Out undefined (type onePassInst has no field or method Out) (typecheck)
  			p_B_Alt := &p.Inst[*p_A_Alt].Out
  			                             ^
  Error: ../../../../../opt/hostedtoolcache/go/1.23.1/x64/src/regexp/onepass.go:263:35: p.Inst[*p_A_Alt].Arg undefined (type onePassInst has no field or method Arg) (typecheck)
  			p_B_Other := &p.Inst[*p_A_Alt].Arg
  			                               ^
  Error: ../../../../../opt/hostedtoolcache/go/1.23.1/x64/src/regexp/onepass.go:265:15: instAlt.Out undefined (type onePassInst has no field or method Out) (typecheck)
  			if instAlt.Out == uint32(pc) {
  			           ^
  Error: ../../../../../opt/hostedtoolcache/go/1.23.1/x64/src/regexp/onepass.go:267:22: instAlt.Arg undefined (type onePassInst has no field or method Arg) (typecheck)
  			} else if instAlt.Arg == uint32(pc) {
  			                  ^
  Error: ../../../../../opt/hostedtoolcache/go/1.23.1/x64/src/regexp/onepass.go:315:15: inst.Op undefined (type *onePassInst has no field or method Op) (typecheck)
  		switch inst.Op {
  		            ^
  Error: ../../../../../opt/hostedtoolcache/go/1.23.1/x64/src/regexp/onepass.go:317:20: inst.Out undefined (type *onePassInst has no field or method Out) (typecheck)
  			ok = check(inst.Out, m) && check(inst.Arg, m)
  			                ^
  Error: ../../../../../opt/hostedtoolcache/go/1.23.1/x64/src/regexp/onepass.go:319:23: inst.Out undefined (type *onePassInst has no field or method Out) (typecheck)
  			matchOut := m[inst.Out]
  			                   ^
  Error: ../../../../../opt/hostedtoolcache/go/1.23.1/x64/src/regexp/onepass.go:332:10: inst.Op undefined (type *onePassInst has no field or method Op) (typecheck)
  				inst.Op = syntax.InstAltMatch
  				     ^
  Error: ../../../../../opt/hostedtoolcache/go/1.23.1/x64/src/regexp/onepass.go:367:16: inst.Rune undefined (type *onePassInst has no field or method Rune) (typecheck)
  			if len(inst.Rune) == 0 {
  			            ^
  
  Error: issues found
  Ran golangci-lint in 23475ms

Version of golangci-lint

1.59

Version of the GitHub Action

6

Workflow file

name: Linting

on:
  push:
    branches:
      - main
  pull_request:
    branches:
      - main

jobs:
  lint_docs:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    - name: Set up Python
      uses: actions/setup-python@v5
      with:
        python-version: 3.9
    - name: Install dependencies
      run:  pip install -U rstcheck doc8 sphinx
    - name: Run rstcheck
      run:  rstcheck -r docs
    - name: Run doc8
      run: doc8 --ignore D001 docs
  lint_go:
    name: Linting Go
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-go@v5
        with:
          go-version: stable
      - name: golangci-lint
        # https://github.com/golangci/golangci-lint-action
        uses: golangci/golangci-lint-action@v6
        with:
          version: v1.59

Golangci-lint configuration

<add your file content here>

Go version

stable

Code example or link to a public repository

cobbler/cli#50

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions