olebedev / go-starter-kit

[abandoned] Golang isomorphic react/hot reloadable/redux/css-modules/SSR starter kit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot Import Absolute Path

siegesmund opened this issue · comments

Using Golang 1.7.1 on Mac OSX 10.11.6.
Cloned go-starter-kit to $GOPATH/src/github.com/<username>/<projectname>

Followed build instructions with npm i -> srlt restore -> make serve
Also tried make install -> make serve

Either way, I get the following error with make serve:

go install /Users/foo/Documents/Programming/go/src/github.com/foo/go-starter-kit/vendor/github.com/olebedev/on
can't load package: package /Users/foo/Documents/Programming/go/src/github.com/foo/go-starter-kit/vendor/github.com/olebedev/on: import "/Users/foo/Documents/Programming/go/src/github.com/foo/go-starter-kit/vendor/github.com/olebedev/on": cannot import absolute path
make: *** [/Users/foo/Documents/Programming/Go/bin/on] Error 1

+1 exact same issue Golang 1.7.1 Ubuntu 14.04

@siegesmund, @sebastianmacias
what is the output of go env regarding this project?


I've just tried to reproduce the bug, but on have been installed as expected. Makefile should produce output like this go install github.com/olebedev/go-starter-kit/vendor/github.com/olebedev/on for this rule. Seems, your IMPORT_PATH was evaluated incorrectly.

Same problem here, I could find a way to work around.

I had that absolute path error. Then I did sudo npm i , srlt restore, then when I did make install it gave me a permission denied to $GOPATH/bin/on .

Then i did npm i, make install, then when trying make serve it says $GOPATH/bin/on permission denied again.

I finally did sudo chown -R whoami $GOPATH and everything is working again.

I faced with this problem, and it's happened by symbolic link.
Example: $GOPATH=/Volumes/Dev/go
and I make a symlink to "/Users/me/go"
Then, when I run "make serve" from "/Users/me/go/src/github.com/olebedev/go-starter-kit", It will through an error "Cannot Import Absolute Path"
So, the solution in my case is run "make serve" from directory:
"/Volumes/Dev/go/src/github.com/olebedev/go-starter-kit"

Hope it help.

Thanks @virusvn.
The problem could be solved by cd $GOPATH/src/github.com/<username>/<project>as was mentioned in README.md.

I'm getting this same issue, and I've made sure to use cd $GOPATH/src/github.com/<username>/<project>.

It was working fine a couple of days ago.

go env:

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/danielque/go"
GORACE=""
GOROOT="/usr/local/Cellar/go/1.9.1/libexec"
GOTOOLDIR="/usr/local/Cellar/go/1.9.1/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/3z/z1r8_syj6798bnh2jlttb30r0000gn/T/go-build989885638=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
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"

EDIT: Looks like my ~/.zshrc had GOPATH=~/gocode and changing it to export GOPATH=~/gocode fixed the issue.

@olebedev I'm still seeing this issue and i believe i'm in the right folder. anything i'm missing?
image

this error can be thrown if you don't have GOPATH set in your shell

For me, this issue seemed to arise from my version of sed not concatenating environment variables with strings properly (this is on MacOS 10.13). I managed to fix it by replacing this line (Makefile, line 12):

IMPORT_PATH = $(shell pwd | sed "s|^$(GOPATH)/src/||g")

...with this line:

IMPORT_PATH = $(shell pwd | sed "s|^$(GOPATH)||g" | sed "s|^src/||g")

I can make a PR for this if it helps more people, depends if it's compatible with versions of sed where the original works as well.