-
Notifications
You must be signed in to change notification settings - Fork 43
Allow librespot-golang to be consumed as a new style Go module #10
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
Conversation
It may be better to use the |
I suggest we hold onto this until Go 1.13 is released with official gomodules support. We can experiment with it however meanwhile, as I agree with @ViRb3 in that we shouldn't hardcode the github path in imports for easier forks (hence why I tend to go the "src" way, even if it's not necessarily optimal). I'll play around with it, I haven't digged much into gomod yet |
I don't think it's a good idea to wait. This issue (go.mod + go gettability) is today the biggest hurdle to try the library. Serving users of the library should come first, then serving forks. Having the full canonical import part inside the headers might seem overkill, but anyone having local modifications can solve this with two or three "replace" directives in their local go.mod. Forks have to resort to what I did here: anisse/librespot-golang@377997a ; but that's only if they want go-gettability themselves. Go 1.11 already has official gomodules support, and Go 1.12 was just released. Not much will change in Go 1.13, just the deprecation of the GOPATH. |
I'll give it a try soon and merge it if it works |
I have taken an alternative approach in my local fork that relies solely on the |
@ViRb3 I'm curious to see how you did this! |
I'm afraid I just lost my laptop, I will be unable to do this for a while. |
It looks like the policy to have fully-qualified import paths is here to stay, see golang/go#20883 (comment). I'm afraid relying solely on the replace directive is only good for local development which is why I was curious to see if you had an alternate solution @ViRb3 . I'd advise to use fully-qualified import paths like most go projects. Very complex libraries do that and it seems to work well for them. |
This is a good initiative, but in order to fully comply with it, this is not enough. |
I've made a PR on |
This has been superseded by #17 and the associated PR |
This pull request allows librespot-golang to be consumed as a new style Go module. I have only changed the import paths in librespotmobile, I don't think any other changes need to be made but it is possible that I am wrong. I don't have gomobile locally.
We have to add in the module substitutions here so that the modules can reference the working copy of each other, otherwise they would reference the git repo rather than the local copy. See https://github.com/go-modules-by-example/index/blob/master/009_submodules/README.md for an explanaition. Once it's upstream however the cross module references must reference the latest commit rather than the nonsense version I used, this does mean that if Spotify and librespot are updated together, there should be a commit updating just Spotify, followed by a commit updating librespot, I believe.
I think ultimately it would make more sense to restructure the code. Do we gain anything by having Spotify as a seperate module to librespot?