Skip to content

Commit d76e95d

Browse files
committed
fix: resolve Go compilation errors
- Add missing 'fmt' import in exporter_test.go - Fix ctx.Done() -> ctx.Err() in loader.go (returns channel, not error) - Remove unused 'crypto/x509' import in svid.go - Update tlsconfig.AuthorizeAnyOf -> AuthorizeOneOf (API change in go-spiffe v2.6.0) - Wrap provider.Shutdown in closure to match func() signature
1 parent 5619d5b commit d76e95d

4 files changed

Lines changed: 7 additions & 5 deletions

File tree

internal/audit/exporter_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package audit
33
import (
44
"context"
55
"errors"
6+
"fmt"
67
"sync"
78
"testing"
89
"time"

internal/repository/loader.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ func (tpl *tenantPlanLoader) load(ctx context.Context, id string) (*PlanRow, err
179179
case res := <-ch:
180180
return res.row, res.err
181181
case <-ctx.Done():
182-
return nil, ctx.Done()
182+
return nil, ctx.Err()
183183
}
184184
}
185185

@@ -269,7 +269,7 @@ func (tsl *tenantSubLoader) load(ctx context.Context, id string) (*SubscriptionR
269269
case res := <-ch:
270270
return res.row, res.err
271271
case <-ctx.Done():
272-
return nil, ctx.Done()
272+
return nil, ctx.Err()
273273
}
274274
}
275275

internal/security/svid.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package security
33
import (
44
"context"
55
"crypto/tls"
6-
"crypto/x509"
76
"fmt"
87
"sync"
98
"time"
@@ -44,7 +43,7 @@ func NewSVIDRotator(ctx context.Context, socketPath string) (*SVIDRotator, error
4443
// - Accepts only clients presenting a SPIFFE ID in the allowed set
4544
// - Automatically uses the latest SVID on each new connection
4645
func (r *SVIDRotator) ServerTLSConfig(allowedIDs ...spiffeid.ID) *tls.Config {
47-
return tlsconfig.MTLSServerConfig(r.source, r.source, tlsconfig.AuthorizeAnyOf(allowedIDs...))
46+
return tlsconfig.MTLSServerConfig(r.source, r.source, tlsconfig.AuthorizeOneOf(allowedIDs...))
4847
}
4948

5049
// ClientTLSConfig returns a tls.Config for gRPC client dials that:

internal/tracing/sampler.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,9 @@ func InitTracer(serviceName string) (func(), error) {
130130
otel.SetTracerProvider(provider)
131131
otel.SetTextMapPropagator(InitPropagators())
132132

133-
return provider.Shutdown, nil
133+
return func() {
134+
_ = provider.Shutdown(context.Background())
135+
}, nil
134136
}
135137

136138
func getEnvFloat(key string, fallback float64) float64 {

0 commit comments

Comments
 (0)