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

Add an option to use package name and version in the import path for new developers #205

Open
schomatis opened this issue Aug 21, 2018 · 4 comments
Assignees

Comments

@schomatis
Copy link
Collaborator

I would like to implement an experimental option that would change the package import paths from src/gx/ipfs/Qm-long-hash/pkg-name to src/gx/pkg/pkg-name/pkg-version that I think it would be very useful for new developers that want to start contributing. I don't want to change the default way gx works (I already tried to push that agenda in #166 without much success :) just to have an option to set the gx/gx-go tandem in this human-readable mode for development environments.

From what I've seen in the code this seems reasonably possible to do without affecting much of the current code but I'm raising the issue to check what would be the potential pitfalls of this change.

The first that comes to mind is that go-ipfs has its import paths hardcoded to the gx/ipfs/hash format but I think that's the exception rather than the rule so this package could be added as an exception in the logic without obscuring the code (and both types of path can coexist in the $GOPATH/src/gx workspace without conflicts).

Another issue is that this scheme would not allow to import two packages with the same name and version but different hashes (in fact turning them into different pieces of data) but that seems like a reasonable constraint.

gx already seems to have a global configuration,

gx/gxutil/config.go

Lines 15 to 19 in a904dc7

type Config struct {
Repos map[string]string `json:"repos,omitempty"`
ExtraRepos map[string]string `json:"extra_repos,omitempty"`
User User `json:"user,omitempty"`
}

and gx-go could be extended in a similar manner.

@schomatis schomatis self-assigned this Aug 21, 2018
@schomatis
Copy link
Collaborator Author

@Stebalien WDYT?

@schomatis
Copy link
Collaborator Author

@Stebalien

@Stebalien
Copy link
Collaborator

I don't see how this will help. Ideally, those paths only appear in build artifacts (once we stop leaving go-ipfs paths rewritten).

Also note, the efforts in #206 should make this a moot point fairly soon. With those changes, a gx lock-install creates a vendor directory and then symlinks gx packages unrewritten into the vendor directory. Eventually, we'd like to replace our normal gx packages with these lock-based packages and make gx lock-install the default gx install command.

@schomatis
Copy link
Collaborator Author

Ok, I'll take a look at that patch then.

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

No branches or pull requests

2 participants