Specify single package location

Hi,

I am wondering if there is a way to define a dependency location without GOPATH? I forked a repo and all dependencies within are references via "k8s.io/ingress/...". The simplest solution would be to symlink all my stuff to ${GOPATH}/src/k8s.io/ingress but I don’t think that’s a good practice.

Adding my repo to the GOPATH would be another solution, but really dirty as I’d have to create the expected GOPATH folder structure like workdir/src/k8s.io/ingress…

So my question is, Is the a way to tell go the location of a specific package?

change your GOPATH for your new project:

cd newproject
export GOPATH=$( pwd )
export PATH=$PATH:$GOPATH/bin

more details: https://golang.org/cmd/go/#hdr-GOPATH_environment_variable

Yeah thought of that too. But my project doesn’t contain a src folder… it’s a fork of https://github.com/kubernetes/ingress

I understand, so, create a folder with name your project and put on in src folder these files of kubernetes.

If the repo you forked is a single package, refer to it by its new name after the fork. If it includes several packages that refer to each other, rewrite the imports to refer to your fork. If you filed a pull request and expect your changes to be merged at some point, perhaps vendor the changed package under its old name for the time being.

Thanks for all your support! That how I solved it in the end:

ln -sf $(pwd) $(pwd)/src/k8s.io/ingress
export GOPATH=$(pwd)

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.