-
Notifications
You must be signed in to change notification settings - Fork 1k
dep fails with root project import: xxx not in GOPATH #911
Comments
This was a GOPATH issue. It might be more appropriate to file a testy experience report. I despise, loath, and detest GOPATH. The fix was to bury the go gettable software inside an artificial $GOPATH/src/[the project] directory and treat it as a component of a null project. |
yeah, projects still have to be rooted within GOPATH, unfortunately. addressing that is something we do think we can do, but it's going to require toolchain changes. so we won't be able to really properly tackle it until we're working on translating dep into the toolchain 😢 |
I didn't understand the solution provided here. Here is my
If I create a package main
import (
"errors"
"github.com/Sirupsen/logrus"
)
func main() {
logrus.Error(errors.New("whoops"))
} If I look at But now I call But I don't understand the source of the problem? |
most discussions tend to use shorthand that omits this for brevity, but "under GOPATH" really means "under the if you put your project at |
Ah, thanks @sdboyer 🙂 |
An easy workaround is to build a dummy folder somewhere ( |
I have the following error, seems the sym link doesn't work? I have installed
|
@rjain15 #1146 (comment) may help clarify that a bit. |
Zally should be cloned in `$GOPATH/src`, and not to `$GOPATH`, as per golang/dep#911. Otherwise dep won't work: ``` $ cd $GOPATH/github.com/zalando/zally/cli/zally/ $ dep ensure root project import: $GOPATH/github.com/zalando/zally/cli/zally is not within any GOPATH/src ``` where as `$GOPATH/src/github.com/zalando/zally/cli/zally` does work with dep.
I can also verify that Hope this info helps a bit. |
FYI, we do builds of Go source code using Bazel. Bazel allows you to do builds outside of #!/bin/sh
export GOPATH="$(mktemp -d "/tmp/dep.XXXXXXXX")"
trap "rm -rf \"${GOPATH}\"" EXIT HUP INT
SRCDIR="${GOPATH}/src/fill-in-the-name-of-your-package-here"
mkdir -p "$(dirname "${SRCDIR}")"
ln -s "$(pwd)" "${SRCDIR}"
cd "${SRCDIR}"
dep "$@" |
For those who is still in trouble getting rid of it hopefully this help, |
we're actually going to have a workaround in the next release that should help with this: #1883 |
I despise, loath, and detest GOPATH. |
any fix on this? i'm also getting
|
from rust cargo to go's dep, I am deeply depressed |
if you are undertaking a new project then go modules is the path you should follow. |
any news on this ? I have been struggling with this issue I tried with simlinks and moving the project folder like this: src/my_project but it didn't work. |
What technical limitation is preventing you from putting your code in the GOPATH? Hoping to understand the context WRT prioritization of things. |
For me, it's that I create a symlink into a project folder that keeps all
my different language projects together and organized.
Running within the symlink folder is when I see the issue.
On Jan 22, 2019 10:56 PM, "Tim Heckman" <[email protected]> wrote:
What technical limitation is preventing you from putting your code in the
GOPATH? Hoping to understand the context WRT prioritization of things.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#911 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AANH-FuQ_7sDarI69lZCSb6aDz3TT3_gks5vGAe1gaJpZM4Okp_u>
.
|
What version of Go (
go version
) anddep
(git describe --tags
) are you using?go version go1.8 linux/amd64
$ cd src/github.com/golang/dep/
$ git describe --tags
v0.1.0-295-gd558b52
$ export | grep GO
GOPATH=/home/kmutch/example
GORACE='halt_on_error=1 history_size=7'
GOROOT=/home/kmutch/go
what commands did you run before running dep?
$ git clone https://github.com/caarlos0/example.git
Cloning into 'example'...
$ cd example
$ export GOPATH=
pwd
$ export PATH=$GOPATH/bin:$PATH
$ make setup
go get -u github.com/alecthomas/gometalinter
go get -u github.com/golang/dep/...
go get -u github.com/pierrre/gotestcover
go get -u golang.org/x/tools/cmd/cover
dep ensure
root project import: /home/kmutch/example not in GOPATH
Makefile:6: recipe for target 'setup' failed
make: *** [setup] Error 1
What
dep
command did you run?$ dep ensure
root project import: xxx not in GOPATH
What did you expect to see?
no errors and the dependencies downloaded into the vendor directory
What did you see instead?
root project import: xxxx not in GOPATH
I have also tried descending into subdirectories of the repo and running dep init from there to see if I can create the dep files, all to no avail.
I freely admit that GOPATH and its side effects are entirely and utterly beyond my comprehension.
The text was updated successfully, but these errors were encountered: