mirror of
https://github.com/devgianlu/go-librespot.git
synced 2026-04-26 05:15:49 +03:00
[GH-ISSUE #190] events/impl.go references missing package, breaking go mod tidy #121
Labels
No labels
bug
enhancement
pull-request
spotify-side
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/go-librespot#121
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @SaeidRp on GitHub (Aug 6, 2025).
Original GitHub issue: https://github.com/devgianlu/go-librespot/issues/190
Hey,
events/impl.gotries to importgithub.com/devgianlu/go-librespot/events/implbut this package doesn't exist in the codebase. This breaksgo mod tidywhen using the library as a dependency.As a workaround, I simply removed
impl.go, since we havedummy.go, which implements thePlugininterface.Error:
@devgianlu commented on GitHub (Aug 6, 2025):
Ah, yes because
go mod tidyignores build tags. Not sure how this could be made portable without deletingimpl.go.@SaeidRp commented on GitHub (Aug 6, 2025):
We can fix this by using a registration pattern instead of direct imports:
New
impl.go:Your local
impl/impl.gowould then do:Would you be okay with this approach? If so, I can open a PR.
@devgianlu commented on GitHub (Aug 6, 2025):
Yes, that might work! Feel free to open a PR.
@SaeidRp commented on GitHub (Aug 7, 2025):
I don’t think this approach will work as I previously thought. I’m curious how is the
impl/directory actually being added? If we’re relying on the files within theimpl/directory, maybe we could include a placeholder/dummyImpl structthere. Then, if users want to provide their own implementation, they can simply overwrite this file or directory. Does that make sense?@devgianlu commented on GitHub (Aug 7, 2025):
I've tried your solution and it seems to work:
Then, inside the implementation:
@SaeidRp commented on GitHub (Aug 7, 2025):
I think that since the
implpackage isn’t imported anywhere, itsinit()function will never be called. As a result, the Plugin won’t actually get registered@SaeidRp commented on GitHub (Sep 13, 2025):
I ended up adding an
events/impl/impl.goplaceholder so that when a plugin is present, it can just overwrite this file. That way, we avoid missing reference issues and everything still compiles cleanly.You can check the changes here:
https://github.com/devgianlu/go-librespot/compare/master...SaeidRp:go-librespot:master
If this approach works for you, let me know and I’ll open a PR.
@devgianlu commented on GitHub (Oct 15, 2025):
Yes, that's probably the best idea. I'd move the dummy implementation into the
implfolder so that everything works smooth.