joefitzgerald/go-plus

Cannot find vendor package.

hjyun328 opened this issue · 5 comments

Prerequisites

  • Have you tried launching atom . from the terminal in your project's directory?
  • Have you verified the output from go env is correct? If it is, please include the output in this issue.
  • 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?
  • Have you updated your Atom packages to the latest versions?
  • Have you read the FAQ?
  • Have you searched the issues to see if others are experiencing the same issue?

Description

Cannot import vendor package in atom go-plus. but it works well without any build error message in terminal.

go-plus (build failed)
image

terminal (build success)
image

Output from atom -v && apm -v

$ atom -v && apm -v
Atom    : 1.34.0
Electron: 2.0.16
Chrome  : 61.0.3163.100
Node    : 8.9.3
apm  2.1.3
npm  6.2.0
node 8.9.3 x64
atom 1.34.0
python 2.7.10
git 2.17.2

Output From go env

GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/hjyun/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/hjyun/workspace/go-path"
GOPROXY=""
GORACE=""
GOROOT="/Users/hjyun/Programs/go"
GOTMPDIR=""
GOTOOLDIR="/Users/hjyun/Programs/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/s3/hhq17ykd2t5cfj14d4s2czsr0000gn/T/go-build317437125=/tmp/go-build -gno-record-gcc-switches -fno-common"

Expected Behavior

No problem with vendor package import

Actual Behavior

Failed importing vendor package.

Most likely the problem is that you have opened your whole GOPATH in atom.
It also gives you a nice hint where it tries to look for the vendored code, in GOROOT (go/src) and your GOPATH (go-path/src), but not in go-sample/vendor

If you open the go-sample folder it should work.

@lloiser
Thanks for your feedback.

I tried to open $GOPATH/src/go-sample folder, but still getting the same error.

2019-01-25 5 30 37

It's unlikely but are you sure that you only have one golang installation? Because GOROOT="/Users/hjyun/Programs/go" is not the default installation on mac.
What's the output of which -a go in your terminal?

I did not install go with pkg file(go1.11.5.darwin-amd64.pkg) but binary file(go1.11.5.darwin-amd64.tar.gz) in the $HOME/Programs directory. So, there is no default installation(/usr/local/go) on my mac.

$ system_profiler SPSoftwareDataType
Software:

    System Software Overview:

      System Version: macOS 10.13.6 (17G65)
      Kernel Version: Darwin 17.7.0
      Boot Volume: Macintosh HD
      Boot Mode: Normal
      Computer Name: hjyun-macbook
      User Name: hjyun (hjyun)
      Secure Virtual Memory: Enabled
      System Integrity Protection: Disabled
      Time since boot: 2:14

$ ls -l /usr/local/go
ls: /usr/local/go: No such file or directory

$ cd $HOME/Programs

$ wget https://dl.google.com/go/go1.11.5.darwin-amd64.tar.gz

$ tar -xvzf https://dl.google.com/go/go1.11.5.darwin-amd64.tar.gz

$ ls -l
drwxr-xr-x  19 hjyun  staff        608  1 24 04:56 go
-rw-r--r--   1 hjyun  staff  120402712  1 24 06:32 go1.11.5.darwin-amd64.tar.gz

$ cat ~/.profile
# go-lang
export GOROOT="$HOME/Programs/go"
export GOPATH="$HOME/workspace/go-path"
export PATH="$PATH:$GOROOT/bin:$GOPATH/bin"

$ source ~/.profile

$ which -a go
/Users/hjyun/Programs/go/bin/go

Sorry, I was stupid.
I ran atom on the terminal and it works fine. But opening the go-sample folder from atom does not work. I didn't know the difference between the two methods, but the problem seems to have been solved anyway. Thank you.

Try 1)
Opening go-path folder from atom
==> not working

Try 2)
Opening go-sample folder from atom
==> not working

Try 3)
hjyun@hjyun-macbook ~/workspace/go-path
$ atom .  
==> not working

Try 4)
hjyun@hjyun-macbook ~/workspace/go-path/src/go-sample
$ atom .
==> working

2019-01-31 12 21 47