openshift / open-service-broker-sdk

A starting point for creating service brokers implementing the Open Service Broker API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Makefile won't work with a symlinked project

jmrodri opened this issue · comments

I put all of my projects in $HOME/dev/some/path. For my golang projects I symlink the projects into my $GOPATH.

GOPATH=/home/jesusr/dev
mkdir -p $GOPATH/src/github.com/openshift/
pushd $HOME/dev
git clone git@github.com:jmrodri/open-service-broker-sdk.git
popd
pushd $GOPATH/src/github.com/openshift
ln -s $HOME/dev/open-service-broker-sdk .
popd

Now if you go into the symlinked directory and run make test you get an error:

pushd $GOPATH/src/github.com/openshift/open-service-broker-sdk
[jesusr@speed3 open-service-broker-sdk{master}]$ make test
glide install --strip-vendor --strip-vcs --update-vendored
[WARN]	The --update-vendored flag is deprecated. This now works by default.
[WARN]	The --strip-vcs flag is deprecated. This now works by default.
[WARN]	stat /home/jesusr/dev/open-service-broker-sdk/src: no such file or directory
[WARN]	stat /home/jesusr/dev/open-service-broker-sdk/vendor/src: no such file or directory
[ERROR]	Could not find any of /home/jesusr/dev/open-service-broker-sdk//src, /home/jesusr/dev/open-service-broker-sdk//vendor/src.
[INFO]	As of Glide 0.5/Go 1.5, this is required.
[ERROR]	Without src, cannot continue.
Makefile:142: recipe for target '.init' failed
make: *** [.init] Error 1

Looks like the ROOT tries to figure out where you are and that doesn't work with symlinks.

working on this now

The specific scenario under which I hit this issue does not yet work.

  1. clone project to some directory
  2. create a symlink to the project, locate the symlink in your GOPATH
  3. attempt to build
  4. fails

If I comment out the export GOPATH line in the Makefile everything works as I'd expect. I'm not sure if there are any other side effects of doing this though.

  1. checkout code directly into GOPATH, WORKS
  2. checkout code directly into GOPATH, create symlink FROM another dir, WORKS
  3. checkout code outside GOPATH, create symlink IN GOPATH, FAILS

In general symlinks + golang == failure. There are long standing incompatibilities with golang and symlinks which are constantly closed by the golang core team with an explanation that golang does not support symlinks. Whenever anything comes along that works the golang core team's answer is "great that works, but it might not tomorrow, you must follow the golang way"

kubernetes and openshift try to make symlink hacks work when we know they can, but in general we will not invest time into making it work. After enough hits on the head it becomes apparent that if one can not change the golang core team the only option is to conform.

@eparis that's understandable. But if I comment out the export GOPATH defined in the Makefile all three of my scenarios work fine. If it's not something we plan to fix, then I can close and just live with it.

Fixed by PR #12

closing since this was fixed, but we still have a bad "getting started" experience since we now rely on the user having a valid GOPATH defined, as well as a proper directory structure.