Skip to content

golangci-lint which was installed from Homebrew cannot load a plugin  #1182

Closed
@tenntenn

Description

@tenntenn

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 1.27.0 built from fb74c2e on 2020-05-13T18:45:55Z
Config file
$ cat .golangci.yml
linters-settings:
  custom:
    called:
      path: /Users/tenntenn/Desktop/example/called.so
      description: called
      original-url: github.com/gostaticanalysis/called
Go environment
$ go version && go env
go version go1.14.4 darwin/amd64
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/tenntenn/Library/Caches/go-build"
GOENV="/Users/tenntenn/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/tenntenn/Documents/gopath"
GOPRIVATE=""
GOPROXY="direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/tenntenn/Desktop/example/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/wm/76fqhrc52ls25p4cmjrjbdqh0000gp/T/go-build134432533=/tmp/go-build -gno-record-gcc-switches -fno-common"
Verbose output of running
$ golangci-lint cache clean
ERRO Unable to load custom analyzer called:/Users/tenntenn/Desktop/example/called.so, plugin: not implemented
$ golangci-lint run -v
INFO [config_reader] Config search paths: [./ /Users/tenntenn/Desktop/example /Users/tenntenn/Desktop /Users/tenntenn /Users /]
INFO [config_reader] Used config file .golangci.yml
ERRO Unable to load custom analyzer called:/Users/tenntenn/Desktop/example/called.so, plugin: not implemented
INFO [lintersdb] Active 10 linters: [deadcode errcheck gosimple govet ineffassign staticcheck structcheck typecheck unused varcheck]
INFO [loader] Go packages loading at mode 575 (compiled_files|deps|imports|name|exports_file|files|types_sizes) took 525.274151ms
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 319.206µs
INFO [linters context/goanalysis] analyzers took 2.898776605s with top 10 stages: buildir: 2.040732182s, inspect: 216.088362ms, fact_purity: 181.508378ms, fact_deprecated: 169.971254ms, printf: 145.820126ms, ctrlflow: 138.675668ms, S1039: 425.535µs, errcheck: 396.659µs, varcheck: 331.239µs, ineffassign: 317.106µs
INFO [linters context/goanalysis] analyzers took 6.437469ms with top 10 stages: buildir: 6.075381ms, U1000: 362.088µs
INFO [runner] processing took 5.112µs with stages: max_same_issues: 2.611µs, skip_dirs: 364ns, max_from_linter: 284ns, nolint: 212ns, cgo: 180ns, autogenerated_exclude: 179ns, filename_unadjuster: 175ns, skip_files: 162ns, diff: 162ns, path_prettifier: 157ns, identifier_marker: 156ns, max_per_file_from_linter: 87ns, exclude: 81ns, path_shortener: 78ns, source_code: 77ns, uniq_by_line: 76ns, exclude-rules: 71ns
INFO [runner] linters took 3.306357851s with stages: goanalysis_metalinter: 3.210039278s, unused: 96.266069ms
INFO File cache stats: 0 entries of total size 0B
INFO Memory: 40 samples, avg is 143.9MB, max is 204.4MB
INFO Execution took 3.86492438s

I had installed golangci-lint via brew as below.

$ brew install golangci/tap/golangci-lint

The binary of golangci-lint cannot load a private linter via a plugin.
I think the binary had been built with CGO_ENABLED=0.
When CGO_ENABLED had set 0, plugin package does not work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions