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

gore can't import vendored packages #72

Closed
robbles opened this issue Sep 21, 2016 · 11 comments · Fixed by #165
Closed

gore can't import vendored packages #72

robbles opened this issue Sep 21, 2016 · 11 comments · Fixed by #165
Assignees

Comments

@robbles
Copy link

robbles commented Sep 21, 2016

I'm trying to import a package inside a vendor subdirectory in my project. I get the following when importing directly:

gore> :import github.com/aws/aws-sdk-go
error: import: can't find import: vendor/github.com/aws/aws-sdk-go

I tried working around it by treating my vendor directory as a temporary GOPATH, and it worked:

ln -s $PWD/vendor /tmp/go/src
GOPATH=/tmp/go go install github.com/aws/aws-sdk-go
GOPATH=/tmp/go gore
gore> :import github.com/aws/aws-sdk-go
(no error)

This isn't really a workable solution though. Is there a way for gore to find these packages? I know they have to be go install'ed first - maybe that's part of the issue?

@syohex
Copy link
Contributor

syohex commented Sep 23, 2016

I suppose you need to specify absolute path of vendored package like github.com/your_name/your_product/vendor/github.com/aws/aws-sdk-go. go/importer package API which gore uses does not permit to import from vendored packages now.

@robbles
Copy link
Author

robbles commented Sep 28, 2016

@syohex It doesn't appear to work that way either. I've tried prefixing the vendored package as if it were under a package named vendor, and still get the same :import: can't find import error.

@syohex
Copy link
Contributor

syohex commented Sep 28, 2016

gore

I cannot reproduce. Please try after installing package.

@james-lawrence
Copy link

james-lawrence commented Nov 22, 2016

it imports it just fine, but its not actually usable.

gore> :import example/vendor/github.com/nlopes/slack
gore> c := slack.New("junk")
package main
	imports example/vendor/github.com/nlopes/slack: use of vendored package not allowed
error: exit status 1
exit status 1

@jasiek
Copy link

jasiek commented Aug 31, 2017

Is this high on the list?

@jamescarr
Copy link

Yeah this is a bit of a nuisance.

@preeya-stripe
Copy link

+1

@motemen
Copy link
Member

motemen commented Oct 10, 2017

gore uses go run to evaluate user inputs, creating temporary .go file. The problem is that, in order to handle vendored packages correctly, you have to put the temporary .go file at current directory, which could make cwd dirty.

Anyway we could attack this, with carefully crafted temporary filenames. I'm going to work on this when I have time.

@motemen motemen self-assigned this Oct 10, 2017
@motemen
Copy link
Member

motemen commented Oct 11, 2017

Also related to #69

netmarkjp added a commit to netmarkjp/gore that referenced this issue Feb 14, 2018
@machinshin
Copy link

any updates on this?

@y00rb
Copy link
Contributor

y00rb commented Dec 5, 2019

@syohex it looks only work under GOPATH, since go publish module feature, some project might not always under GOPATH. so that why someone meet issue can not load package in console. I'm a part of them.

@itchyny itchyny mentioned this issue Dec 31, 2019
18 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants