Skip to content

Commit

Permalink
Fix golang lint
Browse files Browse the repository at this point in the history
  • Loading branch information
sayan-biswas committed Mar 29, 2024
1 parent f908819 commit 449dc45
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 9 deletions.
5 changes: 3 additions & 2 deletions cmd/api/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ import (
"go.uber.org/zap"
"go.uber.org/zap/zapcore"

_ "net/http/pprof"

"github.com/golang-jwt/jwt/v4"
grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware"
grpc_auth "github.com/grpc-ecosystem/go-grpc-middleware/auth"
Expand All @@ -63,7 +65,6 @@ import (
"gorm.io/gorm"
gormlogger "gorm.io/gorm/logger"
"k8s.io/apimachinery/pkg/util/wait"
_ "net/http/pprof"
)

func main() {
Expand Down Expand Up @@ -151,7 +152,7 @@ func main() {

// Shared options for the logger, with a custom gRPC code to log level function.
zapOpts := []grpc_zap.Option{
grpc_zap.WithDecider(func(fullMethodName string, err error) bool {
grpc_zap.WithDecider(func(fullMethodName string, _ error) bool {
return fullMethodName != healthpb.Health_Check_FullMethodName
}),
grpc_zap.WithDurationField(func(duration time.Duration) zapcore.Field {
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/server/v1alpha2/log/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func initConfig(ctx context.Context, cfg *server.Config) (*s3.Client, error) {
var awsConfig aws.Config
var err error
if len(cfg.S3_ENDPOINT) > 0 {
customResolver := aws.EndpointResolverWithOptionsFunc(func(service, region string, options ...any) (aws.Endpoint, error) {
customResolver := aws.EndpointResolverWithOptionsFunc(func(_, region string, _ ...any) (aws.Endpoint, error) {
if region == cfg.S3_REGION {
return aws.Endpoint{
URL: cfg.S3_ENDPOINT,
Expand Down
2 changes: 1 addition & 1 deletion pkg/cli/client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func TestToken(t *testing.T) {
clientset := fake.NewSimpleClientset()
// Token is a subresource of ServiceAccount, so this
// operation looks like a SA creation w.r.t. fake clients.
clientset.PrependReactor("create", "serviceaccounts", func(action ktest.Action) (handled bool, ret runtime.Object, err error) {
clientset.PrependReactor("create", "serviceaccounts", func(_ ktest.Action) (handled bool, ret runtime.Object, err error) {
return true, &v1.TokenRequest{
Status: v1.TokenRequestStatus{
Token: "a",
Expand Down
4 changes: 2 additions & 2 deletions pkg/cli/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func Root() *cobra.Command {
Use: "tkn-results",
Short: "tkn CLI plugin for Tekton Results API",
Long: help,
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
PersistentPreRunE: func(cmd *cobra.Command, _ []string) error {
var overrideAPIAdr string

// Prepare to port-forward if addr config is not set
Expand Down Expand Up @@ -71,7 +71,7 @@ func Root() *cobra.Command {

return nil
},
PersistentPostRun: func(cmd *cobra.Command, args []string) {
PersistentPostRun: func(_ *cobra.Command, _ []string) {
if portForwardCloseChan != nil {
close(portForwardCloseChan)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/internal/protoutil/protoutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func AnyBytes(t testing.TB, m proto.Message) []byte {
// ClearOutputOnly clears any proto fields marked as OUTPUT_ONLY.
func ClearOutputOnly(pb proto.Message) {
m := pb.ProtoReflect()
m.Range(func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool {
m.Range(func(fd protoreflect.FieldDescriptor, _ protoreflect.Value) bool {
opts := fd.Options().(*descriptorpb.FieldOptions)
for _, b := range proto.GetExtension(opts, fbpb.E_FieldBehavior).([]fbpb.FieldBehavior) {
if b == fbpb.FieldBehavior_OUTPUT_ONLY {
Expand Down
2 changes: 1 addition & 1 deletion pkg/watcher/reconciler/dynamic/dynamic.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func NewDynamicReconciler(rc pb.ResultsClient, lc pb.LogsClient, oc ObjectClient
objectClient: oc,
cfg: cfg,
// Always true predicate.
IsReadyForDeletionFunc: func(ctx context.Context, object results.Object) (bool, error) {
IsReadyForDeletionFunc: func(_ context.Context, _ results.Object) (bool, error) {
return true, nil
},
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/watcher/reconciler/dynamic/dynamic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ func TestReconcile_TaskRun(t *testing.T) {
// Pretend that the IsReadyForDeletion function returns an
// error.
errSomethingBad := errors.New("Something really bad happened")
r.IsReadyForDeletionFunc = func(_ context.Context, object watcherresults.Object) (bool, error) {
r.IsReadyForDeletionFunc = func(_ context.Context, _ watcherresults.Object) (bool, error) {
return false, errSomethingBad
}

Expand Down

0 comments on commit 449dc45

Please sign in to comment.