Skip to content

linter goconst not working as intended #2127

Closed
@mkungla

Description

@mkungla

Welcome

  • Yes, I'm using a binary release within 2 latest major releases. Only such installations are supported.
  • Yes, I've searched similar issues on GitHub and didn't find any.
  • Yes, I've included all information below (version, config, etc).
  • Yes, I've tried with the standalone linter if available. (https://golangci-lint.run/usage/linters/)

Description of the problem

  1. golangci-lint run --no-config --disable-all --enable goconst outputs nothing
  2. goconst -min-length 3 -min-occurrences 3 . outputs all the occurrences correctly

Version of golangci-lint

$ golangci-lint --version
golangci-lint has version 1.41.1 built from a2074809 on 2021-06-19T16:01:50Z

Configuration file

$ cat .golangci.yml
# irrelevant --no-config

Go environment

$ go version && go env
go version go1.16.5 linux/amd64

Verbose output of running

$ golangci-lint cache clean
$ golangci-lint run -v
INFO [lintersdb] Active 1 linters: [goconst]      
INFO [loader] Go packages loading at mode 7 (files|compiled_files|name) took 164.628839ms 
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 5.715079ms 
INFO [linters context/goanalysis] analyzers took 1.955345ms with top 10 stages: goconst: 1.955345ms 
INFO [runner] processing took 3.859µs with stages: max_same_issues: 716ns, max_from_linter: 440ns, skip_dirs: 352ns, nolint: 298ns, exclude-rules: 272ns, cgo: 222ns, filename_unadjuster: 179ns, exclude: 170ns, skip_files: 162ns, path_prettifier: 115ns, severity-rules: 113ns, uniq_by_line: 111ns, max_per_file_from_linter: 109ns, path_prefixer: 103ns, diff: 103ns, source_code: 102ns, autogenerated_exclude: 94ns, identifier_marker: 89ns, path_shortener: 59ns, sort_results: 50ns 
INFO [runner] linters took 18.027252ms with stages: goconst: 17.986046ms 
INFO File cache stats: 0 entries of total size 0B 
INFO Memory: 3 samples, avg is 71.8MB, max is 72.3MB 
INFO Execution took 193.656626ms 

Code example or link to a public repository

package main

import "fmt"

func main() {
  fmt.Println("goconst")
  fmt.Println("goconst")
  fmt.Println("goconst")
  fmt.Println("goconst")
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions