go-plus icon indicating copy to clipboard operation
go-plus copied to clipboard

Missing Go Tool

Open AdamIsrael opened this issue 7 years ago • 11 comments

Prerequisites

  • [x] Have you tried launching atom . from the terminal in your project's directory?
  • [x] Have you verified the output from go env is correct? If it is, please include the output in this issue.
  • [x] Have you updated Atom to the latest version?
  • [ ] Have you tried using Atom Beta, which can be run side-by-side with Atom Stable? Is the behavior the same, or different?
  • [x] Have you updated your Atom packages to the latest versions?
  • [X] Have you read the FAQ?
  • [x] Have you searched the issues to see if others are experiencing the same issue?

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.

AdamIsrael avatar Jun 17 '18 23:06 AdamIsrael

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.

bigs avatar Jun 18 '18 18:06 bigs

@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

joefitzgerald avatar Jun 18 '18 18:06 joefitzgerald

@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.

AdamIsrael avatar Jun 18 '18 18:06 AdamIsrael

@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.

joefitzgerald avatar Jun 18 '18 19:06 joefitzgerald

@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:

  • go
  • gofmt
  • go.gofmt

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

AdamIsrael avatar Jun 18 '18 19:06 AdamIsrael

Can you paste the output of which -a go?

joefitzgerald avatar Jun 18 '18 19:06 joefitzgerald

$ which -a go
/snap/bin/go

AdamIsrael avatar Jun 18 '18 19:06 AdamIsrael

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.

AdamIsrael avatar Jun 21 '18 00:06 AdamIsrael

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.

joefitzgerald avatar Jun 21 '18 00:06 joefitzgerald

@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.

bigs avatar Jun 27 '18 22:06 bigs

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"

abferm avatar Nov 29 '18 15:11 abferm