Skip to content

Go executable not found in PATH #1645

@tonydunn

Description

@tonydunn

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.
  • [xi] Yes, I've included all information below (version, config, etc).

Please include the following information:

Version of golangci-lint
$ golangci-lint --version
# paste output here

[tony@linux-box-ajd Installed Packages]$ golangci-lint version
golangci-lint has version 1.35.0 built from 1e5ba1e on 2021-01-08T02:12:28Z

Config file
$ cat .golangci.yml
# paste output here

This file is not present on my system.

Go environment
[tony@linux-box-ajd Installed Packages]$ go version && go env
go version go1.15.6 linux/amd64
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/tony/.cache/go-build"
GOENV="/home/tony/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/tony/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/tony/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
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 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build635968789=/tmp/go-build -gno-record-gcc-switches"
Verbose output of running
$ golangci-lint cache clean

Returns no outut at all

[tony@linux-box-ajd go_code]$ golangci-lint run -v
INFO [config_reader] Config search paths: [./ /home/tony/go_code /home/tony /home /] 
INFO [lintersdb] Active 10 linters: [deadcode errcheck gosimple govet ineffassign staticcheck structcheck typecheck unused varcheck] 
INFO [loader] Go packages loading at mode 575 (exports_file|name|types_sizes|compiled_files|deps|files|imports) took 764.852144ms 
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 40.22292ms 
INFO [linters context/goanalysis] analyzers took 3.220644143s with top 10 stages: buildir: 2.606792498s, inspect: 196.513388ms, fact_purity: 124.322911ms, printf: 109.694044ms, ctrlflow: 90.210645ms, fact_deprecated: 81.969639ms, SA1006: 155.248µs, SA3001: 151.391µs, lostcancel: 150.353µs, SA4021: 149.205µs 
WARN [runner] Can't run linter goanalysis_metalinter: S1011: failed prerequisites: [(inspect@hello, isgenerated@hello): analysis skipped: errors in package: [/home/tony/go_code/hello.go:7:14: string literal not terminated /home/tony/go_code/hello.go:8:38: missing ',' before newline in argument list /home/tony/go_code/hello.go:9:45: missing ',' before newline in argument list /home/tony/go_code/hello.go:10:1: expected operand, found '}' /home/tony/go_code/scratchpad.go:8:16: expected ';', found int /home/tony/go_code/scratchpad.go:10:3: expected '}', found 'EOF']] 
INFO [linters context/goanalysis] analyzers took 366.508µs with top 10 stages: buildir: 309.555µs, U1000: 56.953µs 
WARN [runner] Can't run linter unused: buildir: analysis skipped: errors in package: [/home/tony/go_code/hello.go:7:14: string literal not terminated /home/tony/go_code/hello.go:8:38: missing ',' before newline in argument list /home/tony/go_code/hello.go:9:45: missing ',' before newline in argument list /home/tony/go_code/hello.go:10:1: expected operand, found '}' /home/tony/go_code/scratchpad.go:8:16: expected ';', found int /home/tony/go_code/scratchpad.go:10:3: expected '}', found 'EOF' /home/tony/go_code/hello.go:7:14: string literal not terminated /home/tony/go_code/hello.go:8:38: missing ',' before newline in argument list /home/tony/go_code/hello.go:9:45: missing ',' before newline in argument list /home/tony/go_code/hello.go:10:1: expected operand, found '}' /home/tony/go_code/scratchpad.go:8:16: expected ';', found int /home/tony/go_code/scratchpad.go:10:3: expected '}', found 'EOF'] 
INFO [runner] processing took 7.425µs with stages: max_same_issues: 1.711µs, max_from_linter: 655ns, nolint: 582ns, cgo: 568ns, skip_dirs: 559ns, identifier_marker: 354ns, path_prettifier: 323ns, path_prefixer: 254ns, exclude: 243ns, source_code: 231ns, path_shortener: 225ns, max_per_file_from_linter: 225ns, filename_unadjuster: 218ns, diff: 214ns, uniq_by_line: 212ns, autogenerated_exclude: 200ns, skip_files: 196ns, severity-rules: 183ns, exclude-rules: 147ns, sort_results: 125ns 
INFO [runner] linters took 5.875234236s with stages: goanalysis_metalinter: 5.74391175s, unused: 131.191871ms 
ERRO Running error: buildir: analysis skipped: errors in package: [/home/tony/go_code/hello.go:7:14: string literal not terminated /home/tony/go_code/hello.go:8:38: missing ',' before newline in argument list /home/tony/go_code/hello.go:9:45: missing ',' before newline in argument list /home/tony/go_code/hello.go:10:1: expected operand, found '}' /home/tony/go_code/scratchpad.go:8:16: expected ';', found int /home/tony/go_code/scratchpad.go:10:3: expected '}', found 'EOF' /home/tony/go_code/hello.go:7:14: string literal not terminated /home/tony/go_code/hello.go:8:38: missing ',' before newline in argument list /home/tony/go_code/hello.go:9:45: missing ',' before newline in argument list /home/tony/go_code/hello.go:10:1: expected operand, found '}' /home/tony/go_code/scratchpad.go:8:16: expected ';', found int /home/tony/go_code/scratchpad.go:10:3: expected '}', found 'EOF'] 
INFO Memory: 68 samples, avg is 142.2MB, max is 206.7MB 
INFO Execution took 6.698836909s                  
[tony@linux-box-ajd go_code]$ 

I have installed Sublime Linter, SublimeLinter-golangcilint, and the golangci-lint helper as per instructions, but am unsuccessful in getting the linter to work with Sublime 3 (dev channel build 3210) on Manjaro Linux.

I can run golangci-lint from the command line, and it appears to work OK. It was installed with curl as per the instructions, and the binary lives in /home/tony/.local/bin/golangci-lint. I set debug on for SublimeLinter and when I open a Go file, the output is something like this:

plugins loaded
SublimeLinter: log_handler.py:74      Logging installed; log level INFO
SublimeLinter: sublime_linter.py:74   debug mode: on
SublimeLinter: sublime_linter.py:75   version: 4.16.2
SublimeLinter: sublime_linter.py:345  Delay linting 'boolean.go' for 0.0s
SublimeLinter: linter.py:1088         golangcilint: Checking lint mode 'background' vs lint reason 'on_load'.  Ok.
SublimeLinter: #1 linter.py:1105      golangcilint: linting 'boolean.go'
SublimeLinter: #1 util.py:161         PATH:
    /usr/local/go/bin/
    /home/tony/.local/bin
    /usr/local/bin
    /usr/bin
    /bin
    /usr/local/sbin
    /usr/lib/jvm/default/bin
    /usr/bin/site_perl
    /usr/bin/vendor_perl
    /usr/bin/core_perl
    /var/lib/snapd/snap/bin
SublimeLinter: #1 linter.py:1621      Running ...

  /home/tony/go_code  (working dir)
  $ /home/tony/.local/bin/golangci-lint run --fast --out-format tab /home/tony/go_code

SublimeLinter: #1 linter.py:771       WARNING: golangcilint output:
panic: err: go command required, not found: exec: "go": executable file not found in $PATH: stderr: 

goroutine 1 [running]:
github.com/daixiang0/gci/pkg/gci.init.0()
	/home/runner/go/pkg/mod/github.com/daixiang0/[email protected]/pkg/gci/gci.go:41 +0x106

SublimeLinter: #1 linter.py:773       Note: above warning will become an error in the future. Implement `on_stderr` if you think this is wrong.
SublimeLinter: #1 linter.py:1181      golangcilint: no output
SublimeLinter: sublime_linter.py:593  Linting 'boolean.go' took 0.03s

As you can see, an issue is that golangcilint can't find the 'go' executable, and so generates an error and no output in Sublime. The go executable is in my path I'm sure, so:

[tony@linux-box-ajd Installed Packages]$ type go
go is /usr/local/go/bin/go

[tony@linux-box-ajd Installed Packages]$ env | grep path
PATH=/home/tony/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/var/lib/snapd/snap/bin:/usr/local/go/bin:/home/tony/go/bin

The go executable is in /usr/local/go/bin, so I can't really see why golangcilint thinks it can't find it on the PATH.

Sublime Linter works 100% fine with other languages/linters, it's just this one that I'm struggling with. Is this a genuine issue, or a rookie mistake? Appreciate some help.

Thanks

Tony

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions