Skip to content

Move Go SDK files into datastar directory to remove the need to alias the Go sdk import #870

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

Closed
cshuman opened this issue Apr 29, 2025 · 7 comments
Labels
enhancement New feature or request

Comments

@cshuman
Copy link
Contributor

cshuman commented Apr 29, 2025

Feature Request

Today when importing the Go SDK you need to alias the import as datastar "github.com/starfederation/datastar/sdk/go"

I propose moving the datastar package files into one more nested directory called datastar to remove the need to use an alias of datastar. This would change imports from datastar "github.com/starfederation/datastar/sdk/go" to "github.com/starfederation/datastar/sdk/go/datastar"

All of the examples use the datastar alias because I assume developers would prefer to use datastar as datastar.NewSSE(...) vs go.NewSSE(...).

To account for versioning you could alternatively use a v1 directory up front (e.g. - "github.com/starfederation/datastar/sdk/go/datastar/v1") while still not needing to alias the import to use the package as datastar.NewSSE(...).

Datastar Version

v1.0.0-beta.11

@cshuman cshuman added the enhancement New feature or request label Apr 29, 2025
cshuman added a commit to cshuman/datastar that referenced this issue Apr 29, 2025
…ith the package name to avoid needing to use the datastar alias when importing. Implements starfederation#870
@dkotik
Copy link
Contributor

dkotik commented Apr 29, 2025

Not a bad idea. If the path is going to change, then my PR here will not be needed: #869 (comment)

I submitted the PR with intent of keeping the path as it is.

@delaneyj, if the module path will be changed at all, right now is probably the best time to do it.

@bencroker
Copy link
Collaborator

Just to clarify, will this break everyone’s apps immediately, or only when the next release is tagged?

@cshuman
Copy link
Contributor Author

cshuman commented Apr 29, 2025

With how Go modules work, other people won't bring in this breaking change until you release/tag.

@dkotik
Copy link
Contributor

dkotik commented Apr 30, 2025

Just to clarify, will this break everyone’s apps immediately, or only when the next release is tagged?

If you move the package, it will not break any existing builds. They will simply be stuck at the last version of the old path. To update, they will need to go get it from the new location.

@bencroker
Copy link
Collaborator

Perfect, thanks!

bencroker pushed a commit that referenced this issue Apr 30, 2025
* move datastar package files from sdk/go to sdk/go/datastar to align with the package name to avoid needing to use the datastar alias when importing. Implements #870

* remove extra newline

* update go get in README to reflect the new package import path

* update key/location for goConsts to point to the new location for consts.go
@bencroker
Copy link
Collaborator

Merged #871.

@dkotik
Copy link
Contributor

dkotik commented Apr 30, 2025

Continuation: #874

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants