From a53b2a1d6e320fc90b2274a312b9ec70e85741dd Mon Sep 17 00:00:00 2001 From: sans-sehgal Date: Sat, 22 Feb 2025 17:01:42 -0800 Subject: [PATCH] fix: lint --- go.mod | 5 +++++ go.sum | 2 ++ internal/proto/api_v3/query_service.pb.go | 11 +++++------ internal/sampling/http/thrift-0.9.2/constants.go | 8 +++++--- internal/sampling/http/thrift-0.9.2/ttypes.go | 13 ++++++++++--- pkg/kafka/auth/config.go | 4 +--- 6 files changed, 28 insertions(+), 15 deletions(-) diff --git a/go.mod b/go.mod index 7ee7a518730..5411cad445b 100644 --- a/go.mod +++ b/go.mod @@ -105,7 +105,12 @@ require ( require ( github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.0 // indirect + github.com/google/go-cmp v0.6.0 // indirect go.opentelemetry.io/collector/extension/extensiontest v0.120.0 // indirect + golang.org/x/mod v0.21.0 // indirect + golang.org/x/sync v0.11.0 // indirect + golang.org/x/tools v0.26.0 // indirect + mvdan.cc/gofumpt v0.7.0 // indirect ) require ( diff --git a/go.sum b/go.sum index 58fc56f48f7..d463f695cf9 100644 --- a/go.sum +++ b/go.sum @@ -1057,6 +1057,8 @@ k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 h1:BZqlfIlq5YbRMFko6/PM7F k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340/go.mod h1:yD4MZYeKMBwQKVht279WycxKyM84kkAx2DPrTXaeb98= k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 h1:pUdcCO1Lk/tbT5ztQWOBi5HBgbBP1J8+AsQnQCKsi8A= k8s.io/utils v0.0.0-20240711033017-18e509b52bc8/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +mvdan.cc/gofumpt v0.7.0 h1:bg91ttqXmi9y2xawvkuMXyvAA/1ZGJqYAEGjXuP0JXU= +mvdan.cc/gofumpt v0.7.0/go.mod h1:txVFJy/Sc/mvaycET54pV8SW8gWxTlUuGHVEcncmNUo= rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= diff --git a/internal/proto/api_v3/query_service.pb.go b/internal/proto/api_v3/query_service.pb.go index 6d687b9b221..249d521da23 100644 --- a/internal/proto/api_v3/query_service.pb.go +++ b/internal/proto/api_v3/query_service.pb.go @@ -121,7 +121,6 @@ func (m *GetTraceRequest) GetRawTraces() bool { // that match the conditions, and the resulting number of traces can be less. // // Note: some storage implementations do not guarantee the correct implementation of all parameters. -// type TraceQueryParameters struct { ServiceName string `protobuf:"bytes,1,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty"` OperationName string `protobuf:"bytes,2,opt,name=operation_name,json=operationName,proto3" json:"operation_name,omitempty"` @@ -673,15 +672,15 @@ func (m *GRPCGatewayError_GRPCGatewayErrorDetails) GetHttpStatus() string { // In case of errors, GRPCGatewayError above is used. // // Example: -// {"result": {"resourceSpans": ...}} // -// See https://github.com/grpc-ecosystem/grpc-gateway/issues/2189 +// {"result": {"resourceSpans": ...}} // +// See https://github.com/grpc-ecosystem/grpc-gateway/issues/2189 type GRPCGatewayWrapper struct { Result *TracesData `protobuf:"bytes,1,opt,name=result,proto3" json:"result,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GRPCGatewayWrapper) Reset() { *m = GRPCGatewayWrapper{} } diff --git a/internal/sampling/http/thrift-0.9.2/constants.go b/internal/sampling/http/thrift-0.9.2/constants.go index 74f871d8aa2..b06aab8d23e 100644 --- a/internal/sampling/http/thrift-0.9.2/constants.go +++ b/internal/sampling/http/thrift-0.9.2/constants.go @@ -15,9 +15,11 @@ import ( ) // (needed to ensure safety because of naive import list construction.) -var _ = thrift.ZERO -var _ = fmt.Printf -var _ = bytes.Equal +var ( + _ = thrift.ZERO + _ = fmt.Printf + _ = bytes.Equal +) func init() { } diff --git a/internal/sampling/http/thrift-0.9.2/ttypes.go b/internal/sampling/http/thrift-0.9.2/ttypes.go index 498a01856a9..ee630ef79c9 100644 --- a/internal/sampling/http/thrift-0.9.2/ttypes.go +++ b/internal/sampling/http/thrift-0.9.2/ttypes.go @@ -15,9 +15,11 @@ import ( ) // (needed to ensure safety because of naive import list construction.) -var _ = thrift.ZERO -var _ = fmt.Printf -var _ = bytes.Equal +var ( + _ = thrift.ZERO + _ = fmt.Printf + _ = bytes.Equal +) var GoUnusedProtection__ int @@ -61,6 +63,7 @@ func NewProbabilisticSamplingStrategy() *ProbabilisticSamplingStrategy { func (p *ProbabilisticSamplingStrategy) GetSamplingRate() float64 { return p.SamplingRate } + func (p *ProbabilisticSamplingStrategy) Read(iprot thrift.TProtocol) error { ctx := context.Background() if _, err := iprot.ReadStructBegin(ctx); err != nil { @@ -152,6 +155,7 @@ func NewRateLimitingSamplingStrategy() *RateLimitingSamplingStrategy { func (p *RateLimitingSamplingStrategy) GetMaxTracesPerSecond() int16 { return p.MaxTracesPerSecond } + func (p *RateLimitingSamplingStrategy) Read(iprot thrift.TProtocol) error { ctx := context.Background() if _, err := iprot.ReadStructBegin(ctx); err != nil { @@ -253,6 +257,7 @@ func (p *OperationSamplingStrategy) GetProbabilisticSampling() *ProbabilisticSam } return p.ProbabilisticSampling } + func (p *OperationSamplingStrategy) IsSetProbabilisticSampling() bool { return p.ProbabilisticSampling != nil } @@ -387,6 +392,7 @@ func (p *PerOperationSamplingStrategies) GetDefaultLowerBoundTracesPerSecond() f func (p *PerOperationSamplingStrategies) GetPerOperationStrategies() []*OperationSamplingStrategy { return p.PerOperationStrategies } + func (p *PerOperationSamplingStrategies) Read(iprot thrift.TProtocol) error { ctx := context.Background() if _, err := iprot.ReadStructBegin(ctx); err != nil { @@ -588,6 +594,7 @@ func (p *SamplingStrategyResponse) GetOperationSampling() *PerOperationSamplingS } return p.OperationSampling } + func (p *SamplingStrategyResponse) IsSetProbabilisticSampling() bool { return p.ProbabilisticSampling != nil } diff --git a/pkg/kafka/auth/config.go b/pkg/kafka/auth/config.go index 37e2d64f1f0..102fbef40f2 100644 --- a/pkg/kafka/auth/config.go +++ b/pkg/kafka/auth/config.go @@ -44,8 +44,6 @@ func (config *AuthenticationConfig) SetConfiguration(saramaConfig *sarama.Config authentication = none } - - if config.Authentication == tls || (!config.TLS.Insecure && config.TLS.ServerName != "") { if err := setTLSConfiguration(&config.TLS, saramaConfig, logger); err != nil { return err @@ -78,7 +76,7 @@ func (config *AuthenticationConfig) InitFromViper(configPrefix string, v *viper. config.Kerberos.KeyTabPath = v.GetString(configPrefix + kerberosPrefix + suffixKerberosKeyTab) config.Kerberos.DisablePAFXFast = v.GetBool(configPrefix + kerberosPrefix + suffixKerberosDisablePAFXFAST) - if config.Authentication == tls || (!config.TLS.Insecure && config.TLS.ServerName != ""){ + if config.Authentication == tls || (!config.TLS.Insecure && config.TLS.ServerName != "") { if !v.IsSet(configPrefix + ".tls.enabled") { v.Set(configPrefix+".tls.enabled", "true") }