joefitzgerald / go-plus

An Enhanced Go Experience For The Atom Editor
https://atom.io/packages/go-plus
Other
1.51k stars 128 forks source link

Missing Go Tool #786

Open AdamIsrael opened 6 years ago

AdamIsrael commented 6 years ago

Prerequisites

Description

After a recent update from Ubuntu 16.04 to Ubuntu 18.04, I started getting "Missing Go Tool" when I start atom or run "Update Tools".

I'm running the latest versions of atom and golang installed via snap.

Output from atom -v && apm -v

$ atom -v && apm -v
apm  1.19.0
npm  3.10.10
node 6.9.5 x64
atom 1.27.2
python 2.7.15rc1
git 2.17.1

Output From go env

$ go env                                                                                                                                                                   2 ↵
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/stone/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/stone/go"
GORACE=""
GOROOT="/snap/go/2130"
GOTMPDIR=""
GOTOOLDIR="/snap/go/2130/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
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-build025031559=/tmp/go-build -gno-record-gcc-switches"

Steps to Reproduce

Start atom or manually run "Update Tools"

Expected Behavior

The tools should be found.

Actual Behavior

"Missing Go Tool" error dialog displays and go-plus tools do not work.

bigs commented 6 years ago

To expand on this issue, problems seem to be rooted here: https://github.com/joefitzgerald/go-plus/blob/72d998a58a2b18fa34da588054f7f019e70db77a/lib/config/locator.js#L269

The paths are statically programmed and don't really work for any alternative package managers on *nix systems (I'm specifically working with snaps on Ubuntu). Would be nice to do lookups in PATH as a fallback.

joefitzgerald commented 6 years ago

@bigs

The paths are statically programmed and don't really work for any alternative package managers on *nix systems (I'm specifically working with snaps on Ubuntu). Would be nice to do lookups in PATH as a fallback.

This is not accurate.

Would be nice to do lookups in PATH as a fallback.

This is the PATH lookup you're requesting: https://github.com/joefitzgerald/go-plus/blob/72d998a58a2b18fa34da588054f7f019e70db77a/lib/config/locator.js#L284

AdamIsrael commented 6 years ago

@joefitzgerald What would the right approach here be? The snap-installed golang binaries would be in /snap/bin, so that could be added as a lookup path, or as @bigs suggested, falling back to using the user's $PATH.

joefitzgerald commented 6 years ago

@AdamIsrael are you certain that /snap/bin is in the path (as it is seen by Atom)? If you open Atom's developer tools, you can use the console to look at process.env.PATH.

AdamIsrael commented 6 years ago

@joefitzgerald Yep, confirmed.

Ignore the duplicate paths; I clearly need to clean this up a bit: process.env.PATH "/home/stone/bin:/home/stone/go/bin:/usr/local/bin:/usr/local/sbin:/home/stone/bin:/home/stone/go/bin:/usr/local/bin:/usr/local/sbin:/home/stone/bin:/home/stone/go/bin:/usr/local/bin:/usr/local/sbin:/home/stone/bin:/home/stone/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/stone/.oh-my-zsh/custom/plugins/desk:/home/stone/.oh-my-zsh/custom/plugins/desk:/home/stone/.oh-my-zsh/custom/plugins/desk"

/snap/bin includes:

Might there be another binary it's looking for that I'm missing there?

joefitzgerald commented 6 years ago

Can you paste the output of which -a go?

AdamIsrael commented 6 years ago
$ which -a go
/snap/bin/go
AdamIsrael commented 6 years ago

I've been trying to debug this a bit. I haven't found exactly where the failure is coming from within the plugin, but I can confirm that atom installed from .deb works fine, while the snapped version fails. I know that there's some sandboxing involved in the snap version, i.e., it can't write outside of /snap or the user's home directory. I'm not sure why that would affect finding the go tools, but it's another data point.

joefitzgerald commented 6 years ago

Yeah the atom team explicitly does not support atom unless it is installed via the official atom release. I suspect there will be other incompatibilities when using the snap distribution, you just haven’t found them yet.

bigs commented 6 years ago

@joefitzgerald ah, odd. got a bit lost in the indirection, but that definitely checks out. i'll try and debug this soon... would be nice to know what was happening if only to give a solid error message.

abferm commented 5 years ago

I am experiencing this issue with atom installed from the official deb package. process.env.PATH includes the path for my go binary. Everything was working until recently.

atom -v && apm -v && which -a go && go env
Atom    : 1.32.2
Electron: 2.0.9
Chrome  : 61.0.3163.100
Node    : 8.9.3
apm  2.1.2
npm  6.2.0
node 8.9.3 x64
atom 1.32.2
python 2.7.15rc1
git 2.17.1
/usr/local/go/bin/go
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/aferm/go"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build698398182=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"