Skip to content

Commit

Permalink
Clarify that sources need to be closed (#202)
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Harding <[email protected]>
  • Loading branch information
azdagron authored Oct 19, 2022
1 parent 1e584b8 commit f842f97
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion v2/workloadapi/bundlesource.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ type BundleSource struct {
}

// NewBundleSource creates a new BundleSource. It blocks until the initial
// update has been received from the Workload API.
// update has been received from the Workload API. The source should be closed
// when no longer in use to free underlying resources.
func NewBundleSource(ctx context.Context, options ...BundleSourceOption) (_ *BundleSource, err error) {
config := &bundleSourceConfig{}
for _, option := range options {
Expand Down
3 changes: 2 additions & 1 deletion v2/workloadapi/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ type Client struct {
config clientConfig
}

// New dials the Workload API and returns a client.
// New dials the Workload API and returns a client. The client should be closed
// when no longer in use to free underlying resources.
func New(ctx context.Context, options ...ClientOption) (*Client, error) {
c := &Client{
config: defaultClientConfig(),
Expand Down
3 changes: 2 additions & 1 deletion v2/workloadapi/jwtsource.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ type JWTSource struct {
}

// NewJWTSource creates a new JWTSource. It blocks until the initial update
// has been received from the Workload API.
// has been received from the Workload API. The source should be closed when
// no longer in use to free underlying resources.
func NewJWTSource(ctx context.Context, options ...JWTSourceOption) (_ *JWTSource, err error) {
config := &jwtSourceConfig{}
for _, option := range options {
Expand Down
3 changes: 2 additions & 1 deletion v2/workloadapi/x509source.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ type X509Source struct {
}

// NewX509Source creates a new X509Source. It blocks until the initial update
// has been received from the Workload API.
// has been received from the Workload API. The source should be closed when
// no longer in use to free underlying resources.
func NewX509Source(ctx context.Context, options ...X509SourceOption) (_ *X509Source, err error) {
config := &x509SourceConfig{}
for _, option := range options {
Expand Down

0 comments on commit f842f97

Please sign in to comment.