Skip to content

Commit 8d36766

Browse files
authored
chore(ci): bump golangci-lint version and meet new requirements (#44)
Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>
1 parent 29d39b9 commit 8d36766

File tree

27 files changed

+46
-58
lines changed

27 files changed

+46
-58
lines changed

.github/workflows/lint.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,15 @@ jobs:
3131
- name: Lint main module
3232
uses: golangci/golangci-lint-action@v3
3333
if: ${{ matrix.app == 'main-module' }}
34+
with:
35+
version: v1.52
3436

3537
- name: Lint ${{ matrix.app }}
3638
uses: golangci/golangci-lint-action@v3
3739
if: ${{ matrix.app != 'main-module' }}
3840
with:
3941
working-directory: app/${{ matrix.app }}
42+
version: v1.52
4043

4144
lint-protos:
4245
runs-on: ubuntu-latest

app/artifact-cas/internal/service/status.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ func NewStatusService(version string) *StatusService {
3030
return &StatusService{version: version}
3131
}
3232

33-
func (s *StatusService) Statusz(ctx context.Context, req *pb.StatuszRequest) (*pb.StatuszResponse, error) {
33+
func (s *StatusService) Statusz(_ context.Context, _ *pb.StatuszRequest) (*pb.StatuszResponse, error) {
3434
return &pb.StatuszResponse{}, nil
3535
}
3636

37-
func (s *StatusService) Infoz(ctx context.Context, req *pb.InfozRequest) (*pb.InfozResponse, error) {
37+
func (s *StatusService) Infoz(_ context.Context, _ *pb.InfozRequest) (*pb.InfozResponse, error) {
3838
return &pb.InfozResponse{Version: s.version}, nil
3939
}

app/cli/cmd/output.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package cmd
1818
import (
1919
"encoding/json"
2020
"errors"
21+
"fmt"
2122
"io"
2223
"os"
2324

@@ -65,7 +66,7 @@ func encodeJSONToWriter(v interface{}, w io.Writer) error {
6566
encoder := json.NewEncoder(w)
6667
encoder.SetIndent("", " ")
6768
if err := encoder.Encode(v); err != nil {
68-
return err
69+
return fmt.Errorf("failed to encode output: %w", err)
6970
}
7071

7172
return nil

app/cli/cmd/root.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ func NewRootCmd(l zerolog.Logger) *cobra.Command {
8585
return nil
8686
},
8787
PersistentPostRunE: func(cmd *cobra.Command, args []string) error {
88-
return cleanup(logger, actionOpts.CPConnection)
88+
return cleanup(actionOpts.CPConnection)
8989
},
9090
}
9191

@@ -167,7 +167,7 @@ func newActionOpts(logger zerolog.Logger, conn *grpc.ClientConn) *action.Actions
167167
return &action.ActionsOpts{CPConnection: conn, Logger: logger}
168168
}
169169

170-
func cleanup(logger zerolog.Logger, conn *grpc.ClientConn) error {
170+
func cleanup(conn *grpc.ClientConn) error {
171171
if conn != nil {
172172
if err := conn.Close(); err != nil {
173173
return err

app/cli/cmd/workflow_integration_list.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,17 @@ func integrationAttachmentListTableOutput(attachments []*action.IntegrationAttac
5454
t.AppendHeader(table.Row{"ID", "Kind", "Config", "Attached At", "Workflow"})
5555
for _, i := range attachments {
5656
wf := i.Workflow
57-
int := i.Integration
57+
integration := i.Integration
5858

59-
maps.Copy(i.Config, int.Config)
59+
maps.Copy(i.Config, integration.Config)
6060
var options []string
6161
for k, v := range i.Config {
6262
if v == "" {
6363
continue
6464
}
6565
options = append(options, fmt.Sprintf("%s: %v", k, v))
6666
}
67-
t.AppendRow(table.Row{i.ID, int.Kind, strings.Join(options, "\n"), i.CreatedAt.Format(time.RFC822), wf.NamespacedName()})
67+
t.AppendRow(table.Row{i.ID, integration.Kind, strings.Join(options, "\n"), i.CreatedAt.Format(time.RFC822), wf.NamespacedName()})
6868
t.AppendSeparator()
6969
}
7070

app/cli/cmd/workflow_robotaccount_create.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,7 @@ func newWorkflowRobotAccountCreateCmd() *cobra.Command {
3232
return err
3333
}
3434

35-
if err := encodeOutput([]*action.WorkflowRobotAccountItem{res}, robotAccountListTableOutput); err != nil {
36-
return err
37-
}
38-
39-
return nil
35+
return encodeOutput([]*action.WorkflowRobotAccountItem{res}, robotAccountListTableOutput)
4036
},
4137
}
4238

app/cli/internal/action/artifact_download.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ func (a *ArtifactDownload) Run(downloadPath, digest string) error {
8181
a.Logger.Info().Str("name", info.Filename).Str("to", downloadPath).Msg("downloading file")
8282

8383
// render progress bar
84-
go renderOperationStatus(ctx, client.ProgressStatus, a.Logger, info.Size)
84+
go renderOperationStatus(ctx, client.ProgressStatus, info.Size)
8585
defer close(client.ProgressStatus)
8686

8787
err = client.Download(ctx, w, h.Hex)
@@ -103,7 +103,7 @@ func (a *ArtifactDownload) Run(downloadPath, digest string) error {
103103
return nil
104104
}
105105

106-
func renderOperationStatus(ctx context.Context, progressChan casclient.ProgressStatusChan, output io.Writer, totalSize int64) {
106+
func renderOperationStatus(ctx context.Context, progressChan casclient.ProgressStatusChan, totalSize int64) {
107107
pw := progress.NewWriter()
108108
pw.Style().Visibility.ETA = true
109109
pw.Style().Visibility.Speed = true

app/cli/internal/action/artifact_upload.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ func (a *ArtifactUpload) Run(filePath string) (*CASArtifact, error) {
6060
}
6161

6262
// render progress bar
63-
go renderOperationStatus(context.Background(), client.ProgressStatus, a.Logger, info.Size())
63+
go renderOperationStatus(context.Background(), client.ProgressStatus, info.Size())
6464
defer close(client.ProgressStatus)
6565

6666
res, err := client.Upload(context.Background(), filePath)

app/controlplane/api/controlplane/v1/integrations_config.go

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,9 @@ func (x *IntegrationConfig) Scan(src any) error {
3434
return nil
3535
}
3636
if b, ok := src.([]byte); ok {
37-
if err := proto.Unmarshal(b, x); err != nil {
38-
return err
39-
}
40-
return nil
37+
return proto.Unmarshal(b, x)
4138
}
39+
4240
return fmt.Errorf("unexpected type %T", src)
4341
}
4442

@@ -52,10 +50,8 @@ func (x *IntegrationAttachmentConfig) Scan(src any) error {
5250
return nil
5351
}
5452
if b, ok := src.([]byte); ok {
55-
if err := proto.Unmarshal(b, x); err != nil {
56-
return err
57-
}
58-
return nil
53+
return proto.Unmarshal(b, x)
5954
}
55+
6056
return fmt.Errorf("unexpected type %T", src)
6157
}

app/controlplane/cmd/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ type app struct {
133133
runsExpirer *biz.WorkflowRunExpirerUseCase
134134
}
135135

136-
func filterSensitiveArgs(level log.Level, keyvals ...interface{}) bool {
136+
func filterSensitiveArgs(_ log.Level, keyvals ...interface{}) bool {
137137
for i := 0; i < len(keyvals); i++ {
138138
if keyvals[i] == "operation" {
139139
switch keyvals[i+1] {

0 commit comments

Comments
 (0)