Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

some issues are ignored only on GitHub Action runners#1197

Answeredbyldez
gaby asked this question inQ&A
Discussion options

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

We have a .golangci-lint.yml in the root of the repo. We haven't change golangci-lint version in 6 months and out of nowhere it's applying new rules. I updated the config in a new branch and the workflow still applies the same rules.

Failing workflows can be seen here:https://github.com/gofiber/fiber/actions/workflows/linter.yml

I created a new PR with updated config to ignore the issues and even though it works locally it fails on the CI while ignoring by config.

Trying to fix issues in this PR:gofiber/fiber#3354

Version of golangci-lint

1.64.7

Version of the GitHub Action

latest

Workflow file

name:golangci-linton:push:branches:      -master      -mainpaths-ignore:      -"**/*.md"pull_request:paths-ignore:      -"**/*.md"permissions:# Required: allow read access to the content for analysis.contents:read# Optional: allow read access to pull request. Use with `only-new-issues` option.pull-requests:read# Optional: Allow write access to checks to allow the action to annotate code in the PR.checks:writejobs:golangci:name:lintruns-on:ubuntu-lateststeps:      -uses:actions/checkout@v4      -uses:actions/setup-go@v5with:# NOTE: Keep this in sync with the version from go.modgo-version:"1.23.x"cache:false      -name:golangci-lintuses:golangci/golangci-lint-action@v6with:# NOTE: Keep this in sync with the version from .golangci.ymlversion:v1.62.2

Golangci-lint configuration

run:timeout:5mmodules-download-mode:readonlyallow-serial-runners:trueoutput:sort-results:trueuniq-by-line:falselinters-settings:depguard:rules:all:list-mode:laxdeny:          -pkg:"flag"desc:'`flag` package is only allowed in main.go'          -pkg:"log"desc:'logging is provided by `pkg/log`'          -pkg:"io/ioutil"desc:'`io/ioutil` package is deprecated, use the `io` and `os` package instead'# TODO: Prevent using these without a reason# - pkg: "reflect"#   desc: '`reflect` package is dangerous to use'# - pkg: "unsafe"#   desc: '`unsafe` package is dangerous to use'errcheck:check-type-assertions:truecheck-blank:truedisable-default-exclusions:trueexclude-functions:      -'(*bytes.Buffer).Write'# always returns nil error      -'(*github.com/valyala/bytebufferpool.ByteBuffer).Write'# always returns nil error      -'(*github.com/valyala/bytebufferpool.ByteBuffer).WriteByte'# always returns nil error      -'(*github.com/valyala/bytebufferpool.ByteBuffer).WriteString'# always returns nil errorerrchkjson:report-no-exported:trueexhaustive:check-generated:truedefault-signifies-exhaustive:trueforbidigo:forbid:      -^print(ln)?$      -^fmt\.Print(f|ln)?$      -^http\.Default(Client|ServeMux|Transport)$# TODO: Eventually enable these patterns# - ^panic$# - ^time\.Sleep$analyze-types:truegci:sections:      -standard      -prefix(github.com/gofiber/fiber)      -default      -blank      -dot# - aliascustom-order:truegoconst:numbers:truegocritic:# TODO: Uncomment the following linesenabled-tags:      -diagnostic#   - style#   - performance#   - experimental#   - opinionatedsettings:captLocal:paramsOnly:falseelseif:skipBalanced:falseunderef:skipRecvDeref:false# NOTE: Set this option to false if other projects rely on this project's code# unnamedResult:# checkExported: falsegofumpt:module-path:github.com/gofiber/fiberextra-rules:truegosec:excludes:      -G104# TODO: Enable this again. Mostly provided by errcheckconfig:global:# show-ignored: true # TODO: Enable thisaudit:truegovet:enable-all:truedisable:      -shadowgrouper:# const-require-grouping: true # TODO: Enable thisimport-require-single-import:trueimport-require-grouping:true# var-require-grouping: true # TODO: Conflicts with gofumptloggercheck:require-string-key:trueno-printf-like:truemisspell:locale:USnolintlint:require-explanation:truerequire-specific:truenonamedreturns:report-error-in-defer:trueperfsprint:err-error:truepredeclared:q:truepromlinter:strict:true# TODO: Enable this# reassign:# patterns:# - '.*'revive:enable-all-rules:truerules:# Provided by gomnd linter      -name:add-constantdisabled:true      -name:argument-limitdisabled:true# Provided by bidichk      -name:banned-charactersdisabled:true      -name:cognitive-complexitydisabled:true      -name:comment-spacingsarguments:          -nolintdisabled:true# TODO: Do not disable      -name:cyclomaticdisabled:true# TODO: Enable this check. Currently disabled due to upstream bug.# - name: enforce-repeated-arg-type-style#   arguments:#     - short      -name:enforce-slice-stylearguments:          -makedisabled:true# TODO: Do not disable      -name:exporteddisabled:true      -name:file-headerdisabled:true      -name:function-result-limitarguments:[3]      -name:function-lengthdisabled:true      -name:line-length-limitdisabled:true      -name:max-public-structsdisabled:true      -name:modifies-parameterdisabled:true      -name:nested-structsdisabled:true# TODO: Do not disable      -name:package-commentsdisabled:true      -name:optimize-operands-orderdisabled:true      -name:unchecked-type-assertiondisabled:true# TODO: Do not disable      -name:unhandled-errorarguments:['bytes\.Buffer\.Write']stylecheck:checks:      -all      --ST1000      --ST1020      --ST1021      --ST1022tagalign:strict:truetagliatelle:case:rules:json:snaketenv:all:truetestifylint:enable-all:truetestpackage:skip-regexp:"^$"unparam:# NOTE: Set this option to false if other projects rely on this project's codecheck-exported:falseunused:# TODO: Uncomment these two lines# parameters-are-used: false# local-variables-are-used: false# NOTE: Set these options to true if other projects rely on this project's codefield-writes-are-uses:true# exported-is-used: true # TODO: Fix issues with this option (upstream)exported-fields-are-used:trueusestdlibvars:http-method:truehttp-status-code:truetime-weekday:false# TODO: Set to truetime-month:false# TODO: Set to truetime-layout:false# TODO: Set to truecrypto-hash:truedefault-rpc-path:truesql-isolation-level:truetls-signature-scheme:trueconstant-kind:truewrapcheck:ignorePackageGlobs:      -github.com/gofiber/fiber/*      -github.com/valyala/fasthttpissues:exclude-use-default:falseexclude-case-sensitive:truemax-issues-per-linter:0max-same-issues:0exclude-dirs:    -internal# TODO: Do not ignore interal packagesexclude-rules:    -linters:        -err113text:'do not define dynamic errors, use wrapped static errors instead*'    -path:log/.*\.golinters:        -depguard# Exclude some linters from running on tests files.    -path:_test\.golinters:        -bodyclose        -err113# fix: truelinters:enable:    -asasalint    -asciicheck    -bidichk    -bodyclose    -containedctx    -contextcheck# - cyclop    -decorder    -depguard    -dogsled# - dupl    -dupword# TODO: Enable    -durationcheck    -errcheck    -errchkjson    -errname    -errorlint    -exhaustive# - exhaustivestruct# - exhaustruct    -copyloopvar    -forbidigo    -forcetypeassert# - funlen# - gci # TODO: Enable    -ginkgolinter# - gocheckcompilerdirectives # TODO: Enable# - gochecknoglobals # TODO: Enable# - gochecknoinits # TODO: Enable    -gochecksumtype# - gocognit    -goconst# TODO: Enable    -gocritic# - gocyclo# - godot# - godox    -err113    -gofmt    -gofumpt# - goheader    -goimports# - mnd # TODO: Enable    -gomoddirectives# - gomodguard    -goprintffuncname    -gosec    -gosimple# - gosmopolitan # TODO: Enable    -govet    -grouper# - ifshort # TODO: Enable# - importas# - inamedparam    -ineffassign# - interfacebloat# - interfacer# - ireturn# - lll    -loggercheck# - maintidx    -makezero# - maligned    -mirror    -misspell    -musttag    -nakedret# - nestif    -nilerr    -nilnil# - nlreturn    -noctx    -nolintlint    -nonamedreturns    -nosprintfhostport# - paralleltest # TODO: Enable    -perfsprint# - prealloc    -predeclared    -promlinter    -protogetter    -reassign    -revive    -rowserrcheck# - scopelint # TODO: Enable    -sloglint    -spancheck    -sqlclosecheck    -staticcheck    -stylecheck# - tagalign # TODO: Enable    -tagliatelle    -tenv    -testableexamples    -testifylint# - testpackage # TODO: Enable    -thelper    -tparallel    -typecheck    -unconvert    -unparam    -unused    -usestdlibvars# - varnamelen# - wastedassign # TODO: Enable    -whitespace    -wrapcheck# - wsl    -zerologlint

Go version

1.23.x

Code example or link to a public repository

n/a

You must be logged in to vote
Answered by ldezMar 18, 2025

I will open a dedicated issue:golangci/golangci-lint#5580

Replies: 1 comment 22 replies

Comment options

We are stuck unable to run any CI workflows because of this.

Running locally returns 0 errors. Running on the workflow returns over +10 errors

Image

You must be logged in to vote
22 replies
@ldez
Comment options

ldezMar 17, 2025
Maintainer

I saw yourcomment, I'm still on the topic.

FYI, the problem seems to affect only some revive rules: at leastunhandled-error,var-declaration.

@ldez
Comment options

ldezMar 18, 2025
Maintainer

It takes me days but I found where is the problem, for now I don't have solution because I just discover it. Just wanted to shared because it was a very very long debug session

@ldez
Comment options

ldezMar 18, 2025
Maintainer

The followingrevive rules don't work as expected:

  • context-keys-type
  • errorf
  • modifies-value-receiver
  • range-val-address
  • string-of-int
  • time-equal
  • time-naming
  • unhandled-error
  • var-declaration

The problem seems to only happen with the integration ofrevive insidegolangci-lint (I was not able to reproduce the behavior withrevive as CLI).

The problem is hidden because an error is ignored insiderevive, so it was not possible to see the problem.

The problem cannot be easily detected by tests because it requires using 2 differentGOROOT +GOPATH + Go versions, and using-trimpath during compilation (the problem also happens without-trimpath but the cases are more complex to obtain).

For now, I have no idea how to fix that, but I'm working on it.

@ldez
Comment options

ldezMar 18, 2025
Maintainer

I will open a dedicated issue:golangci/golangci-lint#5580

Answer selected byldez
@gaby
Comment options

@ldez Thanks for the help with this. Glad this was found, pretty sure it has been there for a long time

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
Q&A
Labels
None yet
2 participants
@gaby@ldez
Converted from issue

This discussion was converted from issue #1197 on March 15, 2025 15:02.


[8]ページ先頭

©2009-2025 Movatter.jp