Skip to content

Golangci-lint v2 erroring due to hardcoded flag thats no longer supported in vscode #5640

Closed
@jacobdrury

Description

@jacobdrury

Welcome

  • Yes, I'm using a binary release within 2 latest releases. Only such installations are supported.
  • Yes, I've searched similar issues on GitHub and didn't find any.
  • Yes, I've read the typecheck section of the FAQ.
  • Yes, I've tried with the standalone linter if available (e.g., gocritic, go vet, etc.).
  • I agree to follow this project's Code of Conduct

How did you install golangci-lint?

go install

Description of the problem

After migrating to v2.0.2, I am getting an error in the vscode output console when running the linter. It seems that vscode is always including --print-issued-lines=false in the command which is no longer supported. This breaks the vscode integration. Is there a setting I can change to tell vscode to not include this flag or some other work around?

settings.json

    "go.lintTool": "golangci-lint",
    "go.lintFlags": [
        "--fast-only"
    ],
    "go.formatTool": "custom",
    "go.alternateTools": {
    "customFormatter": "golangci-lint"
    },
    "go.formatFlags": [
        "fmt",
        "--stdin"
    ]

output:

2025-03-26 13:42:18.833 [error] Error while running tool: /Users/jacobdrury/go/bin/golangci-lint run --fast-only --print-issued-lines=false --out-format=colored-line-number --issues-exit-code=0
2025-03-26 13:42:18.834 [error] Error: unknown flag: --print-issued-lines
Failed executing command with error: unknown flag: --print-issued-lines

Version of golangci-lint

$ golangci-lint --version
golangci-lint has version v2.0.2 built with go1.23.2 from (unknown, modified: ?, mod sum: "h1:dMCC8ikPiLDvHMFy3+XypSAuGDBOLzwWqqamer+bWsY=") on (unknown)

Configuration

version: "2"
run:
  allow-parallel-runners: true
output:
  formats:
    text:
      path: stdout
    junit-xml:
      path: lint-report.xml
linters:
  enable:
    - asciicheck
    - copyloopvar
    - errname
    - exptostd
    - forcetypeassert
    - ginkgolinter
    - gocheckcompilerdirectives
    - godox
    - gosec
    - intrange
    - makezero
    - misspell
    - nlreturn
    - nonamedreturns
    - prealloc
    - unconvert
    - unparam
    - usestdlibvars
    - wastedassign
    - whitespace
    - wsl
  settings:
    ginkgolinter:
      suppress-len-assertion: false
      suppress-nil-assertion: false
      suppress-err-assertion: false
      suppress-compare-assertion: false
      suppress-async-assertion: false
      suppress-type-compare-assertion: false
      forbid-focus-container: true
      allow-havelen-zero: false
      force-expect-to: true
      validate-async-intervals: true
      forbid-spec-pollution: true
      force-succeed: true
    godox:
      keywords:
        - TODO
    misspell:
      mode: restricted
      locale: US
      ignore-rules:
        - cancelled
        - aircrafts
    nlreturn:
      block-size: 1
    staticcheck:
      checks:
        - S1000
        - S1001
        - S1002
        - S1003
        - S1004
        - S1005
        - S1006
        - S1007
        - S1008
        - S1009
        - S1010
        - S1011
        - S1012
        - S1017
        - S1018
        - S1019
        - S1020
        - S1021
        - S1023
        - S1024
        - S1025
        - S1028
        - S1029
        - S1030
        - S1031
        - S1032
        - S1033
        - S1034
        - S1035
        - S1036
        - S1037
        - S1038
        - S1039
        - S1040
    whitespace:
      multi-if: false
      multi-func: false
    wsl:
      strict-append: true
      allow-assign-and-call: true
      allow-assign-and-anything: true
      allow-multiline-assign: true
      force-case-trailing-whitespace: 0
      allow-trailing-comment: true
      allow-separated-leading-comment: true
      allow-cuddle-declarations: false
      allow-cuddle-with-calls:
        - Lock
        - RLock
      allow-cuddle-with-rhs:
        - Unlock
        - RUnlock
      force-err-cuddling: true
      error-variable-names:
        - err
      force-short-decl-cuddling: false
      # Controls if you may cuddle variables used anywhere in the following block.
      # https://github.com/bombsimon/wsl/blob/master/doc/configuration.md#allow-cuddle-used-in-block
      # Default: false
      allow-cuddle-used-in-block: true
  exclusions:
    presets:
      - comments
      - common-false-positives
      - legacy
      - std-error-handling
    paths:
      - third_party$
      - builtin$
      - examples$
issues:
  new-from-merge-base: main
  whole-files: true
formatters:
  enable:
    - gofmt
  settings:
    gofmt:
      simplify: true
      rewrite-rules:
        - pattern: interface{}
          replacement: any
        - pattern: a[b:len(a)]
          replacement: a[b:]
        - pattern: (a)
          replacement: a
  exclusions:
    paths:
      - third_party$
      - builtin$
      - examples$

Go environment

$ go version && go env
# paste output here

Verbose output of running

$ golangci-lint cache clean
$ golangci-lint run -v
# paste output here

A minimal reproducible example or link to a public repository

// add your code here

Validation

  • Yes, I've included all information above (version, config, etc.).

Supporter

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: integrationsRelated to integrations and IDEsduplicateThis issue or pull request already existsquestionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions