Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot find package ".../wangzitian0/..." #5

Closed
adomokos opened this issue May 18, 2018 · 7 comments
Closed

Cannot find package ".../wangzitian0/..." #5

adomokos opened this issue May 18, 2018 · 7 comments

Comments

@adomokos
Copy link

I'd like to test drive this project locally. I followed the instructions listed on the README.
Tried to run go test -v ./... -cover, but I received this error:

hello.go:9:2: cannot find package "github.com/wangzitian0/golang-gin-starter-kit/articles" in any of:
	/Users/xyz/Programming/Go/projects/src/github.com/gothinkster/golang-gin-realworld-example-app/vendor/github.com/wangzitian0/golang-gin-starter-kit/articles (vendor tree)
	/usr/local/opt/go/libexec/src/github.com/wangzitian0/golang-gin-starter-kit/articles (from $GOROOT)
	/Users/xyz/Programming/Go/projects/src/github.com/wangzitian0/golang-gin-starter-kit/articles (from $GOPATH)
hello.go:10:2: cannot find package "github.com/wangzitian0/golang-gin-starter-kit/common" in any of:
	/Users/xyz/Programming/Go/projects/src/github.com/gothinkster/golang-gin-realworld-example-app/vendor/github.com/wangzitian0/golang-gin-starter-kit/common (vendor tree)
	/usr/local/opt/go/libexec/src/github.com/wangzitian0/golang-gin-starter-kit/common (from $GOROOT)
	/Users/xyz/Programming/Go/projects/src/github.com/wangzitian0/golang-gin-starter-kit/common (from $GOPATH)
hello.go:11:2: cannot find package "github.com/wangzitian0/golang-gin-starter-kit/users" in any of:
	/Users/xyz/Programming/Go/projects/src/github.com/gothinkster/golang-gin-realworld-example-app/vendor/github.com/wangzitian0/golang-gin-starter-kit/users (vendor tree)
	/usr/local/opt/go/libexec/src/github.com/wangzitian0/golang-gin-starter-kit/users (from $GOROOT)
	/Users/xyz/Programming/Go/projects/src/github.com/wangzitian0/golang-gin-starter-kit/users (from $GOPATH)

Why is the hello.go file is referencing a different repo's model here? Was it a incorrect merge? Am I missing something?

@adomokos
Copy link
Author

I also pulled wangzitian0's repo and that worked.

@wangzitian
Copy link

@adomokos The two repo are totally same, caused by I'm lazy to write relative path. Govendor should auto download the packages to src/ from github.

@adomokos
Copy link
Author

I wonder what I did wrong with govendor, it never pulled in those dependencies.

Feel free to close this issue if you think it's not something you would be concerned about.

@mike-jianxin-mo
Copy link

mike-jianxin-mo commented Aug 26, 2018

I got the same problem and solved it by replacing all the "wangzitian0/golang-gin-starter-kit" to "golang-gin-realworld-example-app" in the application.

PS.
I have created a symlink under the $GOPATH/src/github.com to point to the directory I cloned this repo.

golang-gin-realworld-example-app -> /<directories ... >/learning/golang-gin-realworld-example-app/

@wangzitian0
Copy link
Collaborator

@mike-jianxin-mo The correct way might need to use relative path here. I did not know the project will fork to two place while I wrote this project, and used absolute path. Sorry for the mistake.

@BrutalSimplicity
Copy link

BrutalSimplicity commented May 5, 2019

@wangzitian0 And how might one go about using a relative path? After a quick search, it appears that relative path imports aren't a thing in Go (https://stackoverflow.com/questions/38517593/relative-imports-in-go). All imports must start via the $GOROOT. Wouldn't it be better to rename the imports in this repository to the folder they would be cloned into by default "golang-gin-realworld-example-app"? That way this isn't an issue for people cloning the repository.

@g33klord
Copy link

this need to be merged asap.

This should be followed everytime contributing to a go project: https://splice.com/blog/contributing-open-source-git-repositories-go/

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

No branches or pull requests

6 participants