DisposaBoy / GoSublime

A Golang plugin collection for SublimeText 3, providing code completion and other IDE-like features.
MIT License
3.42k stars 302 forks source link

OSX10.10.2 MarGo build failed #598

Closed nzlov closed 5 years ago

nzlov commented 9 years ago
#cat /etc/profile

export GOOS=darwin
export GOARCH=amd64
export GOROOTPATH=$HOME/program
export GOROOT_BOOTSTRAP=$GOROOTPATH/go1.4.1
export GOROOT=$GOROOTPATH/go
export GOPATH=$HOME/mac/workspace/go
export GOBIN=$GOPATH/bin
export PATH=$GOBIN:$GOROOT/bin:$PATH

| GoSublime error: MarGo build failed | > This is possibly a bug or miss-configuration of your environment. | > For more help, please file an issue with the following build output | > at: https://github.com/DisposaBoy/GoSublime/issues/new | > or alternatively, you may send an email to: gosublime@dby.me | > | > | > cmd: ['', 'build', '-v', '-x', '-o', 'gosublime.margo_r14.12.06-1_devel+256116a.exe', 'gosubli.me/margo'] | > stdout: | > stderr: | > exception: Cannot find commandgo` | install state: busy | sublime.version: 3065 | sublime.channel: stable | about.ann: a14.02.25-1 | about.version: r14.12.06-1 | version: r14.12.06-1 | platform: osx-x64 | ~bin: ~/Library/Application Support/Sublime Text 3/Packages/User/GoSublime/osx-x64/bin | margo.exe: ~bin/gosublime.margo_r14.12.06-1_devel+256116a.exe (ok) | go.exe: ~/mac/workspace/go/bin/go (ok) | go.version: devel+256116a | GOROOT: ~/program/go | GOPATH: ~/mac/workspace/go | GOBIN: ~/mac/workspace/go/bin (should usually be(not set)`) | set.shell: [] | env.shell: /bin/bash | shell.cmd: ['/bin/bash', '-l', '-c', '${CMD}']

nzlov commented 9 years ago

The issue has been resolved,Don't set $GOBIN.But Why?

marcusandre commented 9 years ago

I had this issue a few weeks ago and since I installed Go directly from src. This json-Blob below demonstrates how I had to adjust my GoSublime User settings.

{
  "env": {
    "GOPATH": "$HOME/.golang",
    "GOROOT": "$HOME/.go"
  }
}

Explanation: I cloned the Golang git repository to ~/.go and built (installed) it from there. My Golang projects, packages and binaries reside in ~/.golang/{pkg,src,bin}. This settings coincide with the settings of my bash environment:

# Setup Go
export GOROOT=$HOME/.go
export GOPATH=$HOME/.golang
export PATH=$GOROOT/bin:$GOPATH/bin:$PATH

I hope this helps.

ashi009 commented 9 years ago

Run go env to get go env settings, and by doing that, you will find the correct value for $GOROOT.

GOARCH="amd64"
GOBIN=""
GOCHAR="6"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH=""
GORACE=""
GOROOT="/usr/local/homebrew/Cellar/go/1.4.2/libexec"
GOTOOLDIR="/usr/local/homebrew/Cellar/go/1.4.2/libexec/pkg/tool/darwin_amd64"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fno-common"
CXX="clang++"
CGO_ENABLED="1"

Then set $GOPATH to the directory you want. Build will work after that.

felipap commented 9 years ago

Had the same issue. My $GOROOT was wrong. :)