Closed
Description
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
Hello, the linter produces typecheck error even though everything runs smoothly locally. We have checked build flags and everything should be okay.
Version of golangci-lint
v1.64.7
Version of the GitHub Action
v6.5.2
Workflow file
Here is the workflow file
name: golangci-lint
on:
workflow_call:
permissions: {}
jobs:
golangci:
name: lint
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
working-directory:
- ""
- test
- apis
- pkg/hardwareutils
- hack/tools
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Install libvirt
run: |
sudo apt-get update
sudo apt-get install -y libvirt-dev
- name: Calculate go version
id: vars
run: echo "go_version=$(make go-version)" >> $GITHUB_OUTPUT
- name: Set up Go
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with:
go-version: ${{ steps.vars.outputs.go_version }}
- name: golangci-lint-${{matrix.working-directory}}
uses: golangci/golangci-lint-action@55c2c1448f86e01eaae002a5a3a9624417608d84 # v6.5.2
with:
version: v1.64.7
working-directory: ${{matrix.working-directory}}
args: --timeout=10m
Golangci-lint configuration
Here is the configuration
run:
go: "1.24"
build-tags:
- e2e
- vbmctl
linters:
disable-all: true
enable:
- asasalint
- asciicheck
- bidichk
- bodyclose
#- containedctx
- copyloopvar
- decorder
- dogsled
- dupl
- dupword
- durationcheck
- errcheck
- errchkjson
#- errname
#- errorlint
#- exhaustive
- exptostd
- fatcontext
- forbidigo
- forcetypeassert
- gci
- ginkgolinter
- gocheckcompilerdirectives
- gochecksumtype
- goconst
- gocritic
- godot
- gofmt
- goimports
- goprintffuncname
- gosec
- gosimple
- gosmopolitan
- govet
- iface
- importas
- ineffassign
- intrange
- loggercheck
- makezero
- mirror
- misspell
- mnd
- nakedret
- nilerr
- nilnesserr
- nilnil
- noctx
- nolintlint
- nosprintfhostport
#- perfsprint
- prealloc
- predeclared
- reassign
- revive
- rowserrcheck
- staticcheck
- stylecheck
- tagliatelle
- testifylint
- thelper
- tparallel
- typecheck
- unconvert
- unparam
- unused
- usestdlibvars
- usetesting
- whitespace
# Run with --fast=false for more extensive checks
fast: true
linters-settings:
gosec:
severity: medium
confidence: medium
concurrency: 8
importas:
no-unaliased: true
alias:
# Kubernetes
- pkg: k8s.io/api/core/v1
alias: corev1
- pkg: k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1
alias: apiextensionsv1
- pkg: k8s.io/apimachinery/pkg/apis/meta/v1
alias: metav1
- pkg: k8s.io/apimachinery/pkg/api/errors
alias: k8serrors
- pkg: k8s.io/apimachinery/pkg/util/errors
alias: kerrors
- pkg: k8s.io/component-base/logs/api/v1
alias: logsv1
# Controller Runtime
- pkg: sigs.k8s.io/controller-runtime
alias: ctrl
# BMO
- pkg: github.com/metal3-io/baremetal-operator/apis/metal3.io/v1alpha1
alias: metal3api
nolintlint:
allow-unused: false
require-specific: true
gocritic:
enabled-tags:
- experimental
disabled-checks:
- appendAssign
- dupImport # https://github.com/go-critic/go-critic/issues/845
- evalOrder
- ifElseChain
- octalLiteral
- regexpSimplify
- sloppyReassign
- truncateCmp
- typeDefFirst
- unnamedResult
- unnecessaryDefer
- whyNoLint
- wrapperFunc
tagliatelle:
case:
rules:
json: goCamel
issues:
exclude-dirs:
- mock*
exclude-files:
- "zz_generated.*\\.go$"
- ".*conversion.*\\.go$"
exclude-rules:
- path: test/e2e
linters:
- gosec
- goconst
- path: _test\.go
linters:
- goconst
- gosec
- errcheck
- gci
- noctx
- revive
- stylecheck
- unparam
- unused
# Specific exclude rules for deprecated fields that are still part of the codebase.
# These should be removed as the referenced deprecated item is removed from the project.
- linters:
- staticcheck
text: "SA1019:"
# Disable linters for conversion
- linters:
- staticcheck
text: "SA1019:"
path: .*(api|types)\/.*\/conversion.*\.go$
# Dot imports for gomega or ginkgo are allowed
# within test files.
- path: _test\.go
text: should not use dot imports
- path: (test|e2e)/.*.go
text: should not use dot imports
- linters:
- revive
text: "exported: exported method .*\\.(Reconcile|SetupWithManager|SetupWebhookWithManager) should have comment or be unexported"
# Exclude some packages or code to require comments, for example test code, or fake clients.
- linters:
- revive
text: exported (method|function|type|const) (.+) should have comment or be unexported
source: (func|type).*Fake.*
- linters:
- revive
text: exported (method|function|type|const) (.+) should have comment or be unexported
path: fake_\.go
- linters:
- revive
text: exported (method|function|type|const) (.+) should have comment or be unexported
path: .*(api|types)\/.*\/conversion.*\.go$
- linters:
- revive
text: "var-naming: don't use underscores in Go names;"
path: .*(api|types)\/.*\/conversion.*\.go$
- linters:
- revive
text: "receiver-naming: receiver name"
path: .*(api|types)\/.*\/conversion.*\.go$
- linters:
- stylecheck
text: "ST1003: should not use underscores in Go names;"
path: .*(api|types)\/.*\/conversion.*\.go$
- linters:
- stylecheck
text: "ST1016: methods on the same type should have the same receiver name"
path: .*(api|types)\/.*\/conversion.*\.go$
- linters:
- tagliatelle
text: "RAID|MAC|BMO"
include:
- EXC0002 # include "missing comments" issues from golangci-lint
max-issues-per-linter: 0
max-same-issues: 0
Go version
1.24.4
Code example or link to a public repository
Here is a link to the PR where it happens: metal3-io/baremetal-operator#2497
And here is also a direct link to the failed job https://github.com/metal3-io/baremetal-operator/actions/runs/15705043596/job/44248748259?pr=2497