From 6a8ff6711b1283bf91bfcb8f09daf03c027f56fa Mon Sep 17 00:00:00 2001 From: Alessio Perugini Date: Mon, 25 Mar 2024 10:17:11 +0100 Subject: [PATCH 1/2] golang-ci-lint: bump and disable autofix --- .github/workflows/check-go-task.yml | 2 +- .golangci.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check-go-task.yml b/.github/workflows/check-go-task.yml index ef017004354..dc34e42c2a4 100644 --- a/.github/workflows/check-go-task.yml +++ b/.github/workflows/check-go-task.yml @@ -116,7 +116,7 @@ jobs: - name: golangci-lint uses: golangci/golangci-lint-action@v4 with: - version: v1.55 + version: v1.57 - name: Check style env: diff --git a/.golangci.yml b/.golangci.yml index 851aa05b92b..a5e99f738fc 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -81,7 +81,7 @@ linters-settings: issues: # Fix found issues (if it's supported by the linter). - fix: true + fix: false # List of regexps of issue texts to exclude. # # But independently of this option we use default exclude patterns, From 829f6fdf50fcba5ed5a63ebbbf72f9c27eb4aad2 Mon Sep 17 00:00:00 2001 From: Alessio Perugini Date: Mon, 25 Mar 2024 10:19:36 +0100 Subject: [PATCH 2/2] protogetter: apply lint suggestions --- commands/instances.go | 14 +++++++------- internal/cli/feedback/warn_deprecated.go | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/commands/instances.go b/commands/instances.go index 6c2b3e6a931..df1d96f4c41 100644 --- a/commands/instances.go +++ b/commands/instances.go @@ -480,7 +480,7 @@ func UpdateIndex(ctx context.Context, req *rpc.UpdateIndexRequest, downloadCB rp downloadCB.Start(u, tr("Downloading index: %s", u)) downloadCB.End(false, msg) failed = true - result.UpdatedIndexes = append(result.UpdatedIndexes, report(URL, rpc.IndexUpdateReport_STATUS_FAILED)) + result.UpdatedIndexes = append(result.GetUpdatedIndexes(), report(URL, rpc.IndexUpdateReport_STATUS_FAILED)) continue } @@ -498,9 +498,9 @@ func UpdateIndex(ctx context.Context, req *rpc.UpdateIndexRequest, downloadCB rp downloadCB.Start(u, tr("Downloading index: %s", filepath.Base(URL.Path))) downloadCB.End(false, msg) failed = true - result.UpdatedIndexes = append(result.UpdatedIndexes, report(URL, rpc.IndexUpdateReport_STATUS_FAILED)) + result.UpdatedIndexes = append(result.GetUpdatedIndexes(), report(URL, rpc.IndexUpdateReport_STATUS_FAILED)) } else { - result.UpdatedIndexes = append(result.UpdatedIndexes, report(URL, rpc.IndexUpdateReport_STATUS_SKIPPED)) + result.UpdatedIndexes = append(result.GetUpdatedIndexes(), report(URL, rpc.IndexUpdateReport_STATUS_SKIPPED)) } continue } @@ -512,14 +512,14 @@ func UpdateIndex(ctx context.Context, req *rpc.UpdateIndexRequest, downloadCB rp downloadCB.Start(u, tr("Downloading index: %s", filepath.Base(URL.Path))) downloadCB.End(false, tr("Invalid index URL: %s", err)) failed = true - result.UpdatedIndexes = append(result.UpdatedIndexes, report(URL, rpc.IndexUpdateReport_STATUS_FAILED)) + result.UpdatedIndexes = append(result.GetUpdatedIndexes(), report(URL, rpc.IndexUpdateReport_STATUS_FAILED)) continue } indexFile := indexpath.Join(indexFileName) if info, err := indexFile.Stat(); err == nil { ageSecs := int64(time.Since(info.ModTime()).Seconds()) if ageSecs < req.GetUpdateIfOlderThanSecs() { - result.UpdatedIndexes = append(result.UpdatedIndexes, report(URL, rpc.IndexUpdateReport_STATUS_ALREADY_UP_TO_DATE)) + result.UpdatedIndexes = append(result.GetUpdatedIndexes(), report(URL, rpc.IndexUpdateReport_STATUS_ALREADY_UP_TO_DATE)) continue } } @@ -530,9 +530,9 @@ func UpdateIndex(ctx context.Context, req *rpc.UpdateIndexRequest, downloadCB rp } if err := indexResource.Download(indexpath, downloadCB); err != nil { failed = true - result.UpdatedIndexes = append(result.UpdatedIndexes, report(URL, rpc.IndexUpdateReport_STATUS_FAILED)) + result.UpdatedIndexes = append(result.GetUpdatedIndexes(), report(URL, rpc.IndexUpdateReport_STATUS_FAILED)) } else { - result.UpdatedIndexes = append(result.UpdatedIndexes, report(URL, rpc.IndexUpdateReport_STATUS_UPDATED)) + result.UpdatedIndexes = append(result.GetUpdatedIndexes(), report(URL, rpc.IndexUpdateReport_STATUS_UPDATED)) } } diff --git a/internal/cli/feedback/warn_deprecated.go b/internal/cli/feedback/warn_deprecated.go index af2af4a6a86..0a780574d5e 100644 --- a/internal/cli/feedback/warn_deprecated.go +++ b/internal/cli/feedback/warn_deprecated.go @@ -25,13 +25,13 @@ import ( // WarnAboutDeprecatedFiles warns the user that a type of sketch files are deprecated func WarnAboutDeprecatedFiles(s *rpc.Sketch) { var files []string - for _, f := range s.OtherSketchFiles { + for _, f := range s.GetOtherSketchFiles() { if strings.HasSuffix(f, ".pde") { files = append(files, f) } } - if strings.HasSuffix(s.MainFile, ".pde") { - files = append(files, s.MainFile) + if strings.HasSuffix(s.GetMainFile(), ".pde") { + files = append(files, s.GetMainFile()) } if len(files) > 0 { // .pde files are still supported but deprecated, this warning urges the user to rename them