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

Import a specific version of a package? [question] #218

Open
cosmos72 opened this issue Sep 4, 2020 · 4 comments
Open

Import a specific version of a package? [question] #218

cosmos72 opened this issue Sep 4, 2020 · 4 comments
Assignees
Labels

Comments

@cosmos72
Copy link
Member

@cosmos72 cosmos72 commented Sep 4, 2020

@mattn wrote in #184

Sorry off topic. Can I import specific version of package in notebook?

@cosmos72
Copy link
Member Author

@cosmos72 cosmos72 commented Sep 4, 2020

Currently it's not possible.

My first impression is that it would require two changes:

  1. a syntax to specify both the package and its version - for example something like import "some/package@v1.2" except that @ should be replaced with a character that cannot be part of a package name - anyone knows any such character?
  2. a mechanism to forward the package version to go build - it should be enough to put it in the file go.mod of the plugin created on-the-fly and compiled to load the package.
@elamre
Copy link

@elamre elamre commented Sep 8, 2020

this would be a very appreciated addition. A space character would not work?

@cosmos72
Copy link
Member Author

@cosmos72 cosmos72 commented Sep 8, 2020

Directory names can contain spaces.
Actually, at least on Linux, directory names can contain any character except ASCII 47 (i.e. forward slash '/') and ASCII 0.

Thus import "some/package\000v1.2" could technically work on Linux, and probably also on most Unix-like systems.
It's also really ugly.

@mattn
Copy link
Contributor

@mattn mattn commented Sep 8, 2020

I prefer that gophernotes recognize go.mod file placed in same location of notebook file.

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

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.