Closed
Description
Thank you for creating the issue!
- 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).
Please include the following information:
Version of golangci-lint
$ golangci-lint --version
golangci-lint has version (devel) built from (unknown, mod sum: "") on (unknown)
I built the golangci-lint binary from souce code (tag: v1.30.0)
Config file
$ cat .golangci.yml
linters-settings:
custom:
example:
path: ./example.so
description: The description of the linter
# original-url: github.com/golangci/example-linter
Go environment
$ go version && go env
go version go1.14.3 darwin/amd64
GO111MODULE="on"
GOARCH="amd64"
GOBIN="/Users/chenluxin/go/bin"
GOCACHE="/Users/chenluxin/Library/Caches/go-build"
GOENV="/Users/chenluxin/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/chenluxin/go"
GOPRIVATE=""
GOPROXY="https://goproxy.cn,direct"
GOROOT="/usr/local/go"
GOSUMDB="off"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/chenluxin/Codes/golangci-lint/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/yw/7fx03kmn3qzf1rtwvz87qqtm0000gn/T/go-build461312627=/tmp/go-build -gno-record-gcc-switches -fno-common"
I tried to follow the add private linter guide and found that if I didn't explicitly enable the custom plugin, then the linter wont take effect:
> ./golangci-lint linters --verbose
INFO [config_reader] Config search paths: [./ /Users/chenluxin/Codes/example-plugin-linter /Users/chenluxin/Codes /Users/chenluxin /Users /]
INFO [config_reader] Used config file .golangci.yml
INFO Loaded ./example.so: example
Enabled by your configuration linters:
deadcode: Finds unused code [fast: true, auto-fix: false]
errcheck: Errcheck is a program for checking for unchecked errors in go programs. These unchecked errors can be critical bugs in some cases [fast: true, auto-fix: false]
gosimple (megacheck): Linter for Go source code that specializes in simplifying a code [fast: true, auto-fix: false]
govet (vet, vetshadow): Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string [fast: true, auto-fix: false]
ineffassign: Detects when assignments to existing variables are not used [fast: true, auto-fix: false]
staticcheck (megacheck): Staticcheck is a go vet on steroids, applying a ton of static analysis checks [fast: true, auto-fix: false]
structcheck: Finds unused struct fields [fast: true, auto-fix: false]
typecheck: Like the front-end of a Go compiler, parses and type-checks Go code [fast: true, auto-fix: false]
unused (megacheck): Checks Go code for unused constants, variables, functions and types [fast: false, auto-fix: false]
varcheck: Finds unused global variables and constants [fast: true, auto-fix: false]
...
After I modified the config file as below:
$ cat .golangci.yml
linters:
enable:
- example
linters-settings:
custom:
example:
path: ./example.so
description: The description of the linter
# original-url: github.com/golangci/example-linter
The private linter works:
./golangci-lint linters --verbose
INFO [config_reader] Config search paths: [./ /Users/chenluxin/Codes/example-plugin-linter /Users/chenluxin/Codes /Users/chenluxin /Users /]
INFO [config_reader] Used config file .golangci.yml
INFO Loaded ./example.so: example
Enabled by your configuration linters:
deadcode: Finds unused code [fast: true, auto-fix: false]
errcheck: Errcheck is a program for checking for unchecked errors in go programs. These unchecked errors can be critical bugs in some cases [fast: true, auto-fix: false]
**example: The description of the linter [fast: true, auto-fix: false]**
gosimple (megacheck): Linter for Go source code that specializes in simplifying a code [fast: true, auto-fix: false]
govet (vet, vetshadow): Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string [fast: true, auto-fix: false]
ineffassign: Detects when assignments to existing variables are not used [fast: true, auto-fix: false]
staticcheck (megacheck): Staticcheck is a go vet on steroids, applying a ton of static analysis checks [fast: true, auto-fix: false]
structcheck: Finds unused struct fields [fast: true, auto-fix: false]
typecheck: Like the front-end of a Go compiler, parses and type-checks Go code [fast: true, auto-fix: false]
unused (megacheck): Checks Go code for unused constants, variables, functions and types [fast: false, auto-fix: false]
varcheck: Finds unused global variables and constants [fast: true, auto-fix: false]
...
This is different from the guide:
Custom linters are enabled by default
Is there something wrong here ?