Skip to content

Move SvixHttpClient to internal package #1884

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

Merged
merged 1 commit into from
Apr 15, 2025
Merged

Move SvixHttpClient to internal package #1884

merged 1 commit into from
Apr 15, 2025

Conversation

svix-mman
Copy link
Contributor

@svix-mman svix-mman commented Apr 14, 2025

This is done in preparation for the new internal API client

In Go, the internal package has special semantics. https://pkg.go.dev/cmd/go#hdr-Internal_Directories
So we can define public method for our SDK to consume, but external packages wont be able to import the internal package
For example this is the error I get when trying to import the internal package in the TF provider

package github.com/svix/terraform-provider-svix
        main.go:10:3: use of internal package github.com/svix/svix-webhooks/go/internal not allowed

This is technically a breaking change, because the svix.SvixHttpClient struct will no longer be available
However, this is not an issue. Since there is no use in defining the svix.SvixHttpClient by hand, because the only use case it has is to be part of the resource structs

type Application struct {
	client *SvixHttpClient
}

But a user of our SDK would not be define the Application struct, because client is not an exported field.

@svix-mman svix-mman requested a review from a team as a code owner April 14, 2025 18:36
This is done in preparation for the new internal API client
Copy link
Member

@svix-jplatte svix-jplatte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. Why were these public in the first place? Should they not have been lowerCamelCase private symbols?

@svix-mman
Copy link
Contributor Author

Why were these public in the first place?

Not sure 🤷

Should they not have been lowerCamelCase private symbols?

Yup

@svix-mman svix-mman merged commit 2bce1a6 into main Apr 15, 2025
11 checks passed
@svix-mman svix-mman deleted the mendy/prep-go-lib branch April 15, 2025 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants