Skip to content
This repository has been archived by the owner on Feb 26, 2019. It is now read-only.

godep restore unrecognized path #258

Open
allenanie opened this issue Aug 9, 2015 · 7 comments
Open

godep restore unrecognized path #258

allenanie opened this issue Aug 9, 2015 · 7 comments

Comments

@allenanie
Copy link

Hi,
I'm developing two go projects side by side, and one project is dependent on the other, and must reflect the changes made immediately (so no uploading to github and pull down from there). Both the my projects (projA, projB) are in my GOPATH locally, so I can invoke something like:

import "projA/comm"

Without any problem (at least not according to my IDE - intelliJ). Problem starts when I want to package it using godep and ship it to a remote server (actually even locally). I run godep save to generate JSON file and workspace directory. Then I run godep restore locally, and it tells me:

godep: unrecognized import path "projA/comm"

When I ship it to the server, same error happens. As reason stated above, I really want to be able to have projB reflect projA's changes locally (by typing godep save or godep update). But what is this error and how can I get rid of it?

P.S.: I use docker to ship code, and this is a part of my docker file:

# Get godeps from main repo
RUN go get github.com/tools/godep

RUN godep go build

RUN godep go install

RUN godep restore

# Install
RUN go install nag_cron
@freeformz
Copy link

@windweller I can't reproduce this error. To test I put together 2 sample projects in my $GOPATH like so..

$ echo $GOPATH
/Users/emuller/go

$ cd $GOPATH/src
/Users/emuller/go/src

$ cat projA/comm/a.go
package comm

const Variable = "Hello From projA/comm"

$ cat projB/b.go
package main

import (
    "fmt"
    "projA/comm"
)

func main() {
    fmt.Println(comm.Variable)
}

$ cd projB
$ find .
.
./b.go
./Godeps
./Godeps/_workspace
./Godeps/_workspace/.gitignore
./Godeps/_workspace/src
./Godeps/_workspace/src/projA
./Godeps/_workspace/src/projA/comm
./Godeps/_workspace/src/projA/comm/a.go
./Godeps/Godeps.json
./Godeps/Readme

$ godep go run b.go
Hello From projA/comm

projA was saved inside of projB with godep save ./... after b.go was written.

Can you provide steps to reproduce?

@freeformz
Copy link

Oh wait this was about godep restore. I get that same error. But you only ever need to do a restore if you want to reset the copies of a dependency in your GOPATH to the vendored versions. This is still a bug though as projA/comm is valid AFAIK.

@allenanie
Copy link
Author

Wait..so if I include all the code (library code and source code) in work_space, I don't have to run godep restore? So what I should run on Docker-based remote server is godep go run b.go (assuming b is the main entrance for my projectB)?

Can I instead run the command already in my Dockerfile: RUN go install projB?

@freeformz
Copy link

So while it's technically possible to do so in Go, atm godep (because of it's use of the go toolings vcs library) only fully supports packages in host/user/pkg format. But ...

You do not need to run godep restore if you wrap your go commands with godep. So godep go install ./.... Furthermore if you rewrite your deps (godep save -r ./...) you don't need to use godep on the server at all.

@freeformz
Copy link

The way I would do this is ...

When writing code use godep save -r ./....

When installing code run go install -v ./....

@allenanie
Copy link
Author

OK! Good to know, so I just need to change my RUN godep go install to RUN godep go install ./...! Thanks. I hope this bug will be resolved :)

Or I'll do it your way. Thanks.

@beyhan
Copy link

beyhan commented Sep 22, 2015

I have faced the same issue. Are there plans to fix this?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants