[GH-ISSUE #56] feat: go gettable module path #48

Closed
opened 2026-02-28 14:24:55 +03:00 by kerem · 2 comments
Owner

Originally created by @marcus-crane on GitHub (Aug 3, 2024).
Original GitHub issue: https://github.com/devgianlu/go-librespot/issues/56

Hey there,

First of all, amazing work on go-librespot and reverse engineering all of the Spotify stuff (dealer gateway etc).

I was actually looking to use parts of go-librespot as a library just to request my player state and use it to power a playback widget.

I realise that go-librespot isn't intended to be used as a library of course but it's all wired up nicely enough that it does actually work and I have a minimum implementation using both the dealer and spclient packages to receive messages.

The only remaining thing is that go-librespot is not actually importable as a standard Go library, due to its module path in go.mod not being a valid path.

Basically, go get expects the path that you require a package from (in this case, the Github URL) to be the same as the module path (the module directive in go.mod)

CleanShot 2024-08-03 at 13 18 46@2x

I realise of course that supporting usage as a library is an entirely different thing than supporting an audio client so I don't expect that anyone using it as a library should expect any guarantees around breaking changes, interfaces staying public and so on.

It just turns out that everything in Go is importable as a library whether intended or not so it's a nice side effect to support even if it's not explicitly offered.

In the meantime, I've been getting by with cloning go-librespot into my local repo and then adding the following to my go.mod file as a workaround:

replace go-librespot => ./go-librespot

require (
	go-librespot v0.0.0-00010101000000-000000000000
)

Much appreciated 🙂

Originally created by @marcus-crane on GitHub (Aug 3, 2024). Original GitHub issue: https://github.com/devgianlu/go-librespot/issues/56 Hey there, First of all, amazing work on go-librespot and reverse engineering all of the Spotify stuff (dealer gateway etc). I was actually looking to use parts of `go-librespot` as a library just to request my player state and use it to power a playback widget. I realise that `go-librespot` isn't intended to be used as a library of course but it's all wired up nicely enough that it does actually work and I have a minimum implementation using both the `dealer` and `spclient` packages to receive messages. The only remaining thing is that `go-librespot` is not actually importable as a standard Go library, due to its module path in `go.mod` not being a valid path. Basically, `go get` expects the path that you require a package from (in this case, the Github URL) to be the same as the module path ([the `module` directive in go.mod](https://github.com/devgianlu/go-librespot/blob/master/go.mod#L1)) ![CleanShot 2024-08-03 at 13 18 46@2x](https://github.com/user-attachments/assets/7c00fa4c-d8e4-43e5-96b7-ffc2f976615f) I realise of course that supporting usage as a library is an entirely different thing than supporting an audio client so I don't expect that anyone using it as a library should expect any guarantees around breaking changes, interfaces staying public and so on. It just turns out that everything in Go is importable as a library whether intended or not so it's a nice side effect to support even if it's not explicitly offered. In the meantime, I've been getting by with cloning `go-librespot` into my local repo and then adding the following to my `go.mod` file as a workaround: ```go replace go-librespot => ./go-librespot require ( go-librespot v0.0.0-00010101000000-000000000000 ) ``` Much appreciated 🙂
kerem closed this issue 2026-02-28 14:24:55 +03:00
Author
Owner

@devgianlu commented on GitHub (Aug 6, 2024):

You are most definitely right, the module name should match that of the repository. I have updated it: github.com/devgianlu/go-librespot@34f6371d9d

<!-- gh-comment-id:2272311325 --> @devgianlu commented on GitHub (Aug 6, 2024): You are most definitely right, the module name should match that of the repository. I have updated it: https://github.com/devgianlu/go-librespot/commit/34f6371d9d1271ad74dcc8afd3fbff78480afd9a
Author
Owner

@marcus-crane commented on GitHub (Aug 7, 2024):

Thanks! I can remove my temporary git submodule but glad to say that I got a nice working Spotify Connect client with your great library 🙂

<!-- gh-comment-id:2272492465 --> @marcus-crane commented on GitHub (Aug 7, 2024): Thanks! I can remove my temporary git submodule but glad to say that I got a nice working Spotify Connect client with your great library 🙂
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/go-librespot#48
No description provided.