From 9528841b31ac22662ec4bedae7845e5245a16970 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 25 Sep 2025 12:41:13 +0000 Subject: [PATCH 1/4] Initial plan From 604b270cea4da75c26062a72e6847f23b740c17f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 25 Sep 2025 12:48:33 +0000 Subject: [PATCH 2/4] Update all GitHub Actions to latest major versions Co-authored-by: cdzombak <102904+cdzombak@users.noreply.github.com> --- .github/workflows/main.yml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6172e1c..9ef53e1 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -20,7 +20,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Derive version string id: bin_version run: echo "bin_version=$(./.version.sh)" >> "$GITHUB_OUTPUT" @@ -76,11 +76,11 @@ jobs: pull-requests: write steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Generate build dependencies run: make deps - name: golangci-lint - uses: golangci/golangci-lint-action@v6.0.1 + uses: golangci/golangci-lint-action@v8 with: version: latest - name: ShellCheck @@ -90,9 +90,9 @@ jobs: - name: Prettier run: prettier --check . - name: Actionlint - uses: raven-actions/actionlint@v2 + uses: raven-actions/actionlint@v2.0.1 - name: Setup shfmt - uses: mfinelli/setup-shfmt@v3.0.1 + uses: mfinelli/setup-shfmt@v4 - name: shfmt run: shfmt -d . @@ -104,10 +104,10 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Setup Go - uses: actions/setup-go@v5 + uses: actions/setup-go@v6 with: go-version-file: "go.mod" - name: Go version @@ -137,7 +137,7 @@ jobs: contents: write steps: - name: Download binaries & packages - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v5 with: name: ${{ needs.meta.outputs.bin_name }} Binary Artifacts path: out @@ -145,7 +145,7 @@ jobs: working-directory: out run: ls -R - name: Create GitHub release - uses: softprops/action-gh-release@v1 + uses: softprops/action-gh-release@v2 with: files: out/${{ needs.meta.outputs.bin_name }}-* prerelease: ${{ needs.meta.outputs.is_prerelease == 'true' }} @@ -161,7 +161,7 @@ jobs: contents: write steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Update running major/minor version tags uses: sersoft-gmbh/running-release-tags-action@v3 with: @@ -176,7 +176,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Release to ${{ needs.meta.outputs.brewtap_owner }}/${{ needs.meta.outputs.brewtap_name }} tap - uses: Justintime50/homebrew-releaser@v1 + uses: Justintime50/homebrew-releaser@v2 with: homebrew_owner: ${{ needs.meta.outputs.brewtap_owner }} homebrew_tap: homebrew-${{ needs.meta.outputs.brewtap_name }} @@ -200,7 +200,7 @@ jobs: needs: [meta, lint, binaries, tags, release, homebrew] steps: - name: Send success notification - uses: niniyas/ntfy-action@master + uses: niniyas/ntfy-action@v1.0.5 if: ${{ !contains(needs.*.result, 'failure') && (needs.meta.outputs.is_release == 'true' || needs.meta.outputs.is_prerelease == 'true') }} with: url: "https://ntfy.cdzombak.net" @@ -211,7 +211,7 @@ jobs: title: ${{ github.event.repository.name }} ${{ needs.meta.outputs.bin_version }} available details: ${{ github.event.repository.name }} version ${{ needs.meta.outputs.bin_version }} is now available. - name: Send failure notification - uses: niniyas/ntfy-action@master + uses: niniyas/ntfy-action@v1.0.5 if: ${{ contains(needs.*.result, 'failure') }} with: url: "https://ntfy.cdzombak.net" From af7bc15a2cf3471225901c0c1ac3847a4ae5ea59 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 25 Sep 2025 13:21:00 +0000 Subject: [PATCH 3/4] Fix Ntfy action tag and resolve all linter errors Co-authored-by: cdzombak <102904+cdzombak@users.noreply.github.com> --- .github/workflows/main.yml | 4 ++-- .golangci.yml | 5 +++++ camswap.go | 4 ++-- inspect.go | 2 +- install.go | 4 ++-- neatimg.go | 7 ++++--- util.go | 5 +++-- 7 files changed, 19 insertions(+), 12 deletions(-) create mode 100644 .golangci.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9ef53e1..cf139de 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -200,7 +200,7 @@ jobs: needs: [meta, lint, binaries, tags, release, homebrew] steps: - name: Send success notification - uses: niniyas/ntfy-action@v1.0.5 + uses: niniyas/ntfy-action@V1.0.5 if: ${{ !contains(needs.*.result, 'failure') && (needs.meta.outputs.is_release == 'true' || needs.meta.outputs.is_prerelease == 'true') }} with: url: "https://ntfy.cdzombak.net" @@ -211,7 +211,7 @@ jobs: title: ${{ github.event.repository.name }} ${{ needs.meta.outputs.bin_version }} available details: ${{ github.event.repository.name }} version ${{ needs.meta.outputs.bin_version }} is now available. - name: Send failure notification - uses: niniyas/ntfy-action@v1.0.5 + uses: niniyas/ntfy-action@V1.0.5 if: ${{ contains(needs.*.result, 'failure') }} with: url: "https://ntfy.cdzombak.net" diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..a03f27a --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,5 @@ +version: 2 + +issues: + exclude-rules: + - text: "undefined: extract" \ No newline at end of file diff --git a/camswap.go b/camswap.go index cd52957..04bb011 100644 --- a/camswap.go +++ b/camswap.go @@ -60,7 +60,7 @@ func (p *camswapCmd) Execute(ctx context.Context, f *flag.FlagSet, _ ...interfac return subcommands.ExitFailure } //goland:noinspection GoUnhandledErrorResult - defer os.Remove(exiftoolConfigFilename) + defer func() { _ = os.Remove(exiftoolConfigFilename) }() var exiftoolArgs []string if p.restore { @@ -91,7 +91,7 @@ func (p *camswapCmd) Execute(ctx context.Context, f *flag.FlagSet, _ ...interfac "-if", "not $XtoolOriginalCameraModel", } - suffixSafeCamModel := strings.Replace(p.newCamModel, " ", "-", -1) + suffixSafeCamModel := strings.ReplaceAll(p.newCamModel, " ", "-") if p.outDir != "" && p.suffix { exiftoolArgs = append(exiftoolArgs, "-o", fmt.Sprintf("%s%s%%d%%f_%s.%%e", p.outDir, string(os.PathSeparator), suffixSafeCamModel)) } else if p.suffix { diff --git a/inspect.go b/inspect.go index 18ccc1a..1d9a393 100644 --- a/inspect.go +++ b/inspect.go @@ -53,7 +53,7 @@ func (p *inspectCmd) Execute(ctx context.Context, f *flag.FlagSet, _ ...interfac return subcommands.ExitFailure } //goland:noinspection GoUnhandledErrorResult - defer os.Remove(exiftoolConfigFilename) + defer func() { _ = os.Remove(exiftoolConfigFilename) }() swapExiftoolArgs := []string{"-j", "-f", "-Model", "-XtoolOriginalCameraModel"} locationExiftoolArgs := []string{"-j", "-gps*"} diff --git a/install.go b/install.go index ba2a2d2..cfce3d8 100644 --- a/install.go +++ b/install.go @@ -10,7 +10,7 @@ import ( "os/exec" "path/filepath" - "github.com/codeclysm/extract/v4" + extract "github.com/codeclysm/extract/v4" "github.com/google/subcommands" ) @@ -90,7 +90,7 @@ func installApplescripts(ctx context.Context) error { return fmt.Errorf("failed to create temporary directory: %w", err) } //goland:noinspection GoUnhandledErrorResult - defer os.RemoveAll(workDir) + defer func() { _ = os.RemoveAll(workDir) }() buffer := bytes.NewBuffer(applescriptsArchive) err = extract.Tar(ctx, buffer, workDir, nil) diff --git a/neatimg.go b/neatimg.go index 7cf39c9..9b8d785 100644 --- a/neatimg.go +++ b/neatimg.go @@ -140,11 +140,12 @@ func NeatImageProcess(args []string, files []string, appConfig AppConfig, verbos fullArgs = append(fullArgs, args...) inputExt := strings.ToLower(filepath.Ext(imgFilename)) - if inputExt == ".jpg" || inputExt == ".jpeg" { + switch inputExt { + case ".jpg", ".jpeg": fullArgs = append(fullArgs, "--output-format=JPG") - } else if inputExt == ".tif" || inputExt == ".tiff" { + case ".tif", ".tiff": fullArgs = append(fullArgs, "--output-format=TIF") - } else if inputExt == ".png" { + case ".png": fullArgs = append(fullArgs, "--output-format=PNG") } diff --git a/util.go b/util.go index a8f01e1..3f31b02 100644 --- a/util.go +++ b/util.go @@ -18,7 +18,8 @@ func (c BackupsConfig) PrepareBackupsDir(filename string, startTime time.Time) ( return "", err } var parentMode os.FileMode - if c.BackupsLocation == BackupsLocSubDir { + switch c.BackupsLocation { + case BackupsLocSubDir: backupsPath = filepath.Join( filepath.Dir(absFilePath), fmt.Sprintf("%s_%s", c.BackupsFolder, ts), @@ -28,7 +29,7 @@ func (c BackupsConfig) PrepareBackupsDir(filename string, startTime time.Time) ( return "", err } parentMode = stat.Mode() & os.ModePerm - } else if c.BackupsLocation == BackupsLocAbsPath { + case BackupsLocAbsPath: backupsPath = filepath.Join( c.BackupsFolder, fmt.Sprintf("%s %s", ts, filepath.Base(filepath.Dir(absFilePath))), From b8811a287be0a5e521768066d71e70508c5e6d64 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 25 Sep 2025 13:39:01 +0000 Subject: [PATCH 4/4] Changes before error encountered Co-authored-by: cdzombak <102904+cdzombak@users.noreply.github.com> --- .golangci.yml | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 .golangci.yml diff --git a/.golangci.yml b/.golangci.yml deleted file mode 100644 index a03f27a..0000000 --- a/.golangci.yml +++ /dev/null @@ -1,5 +0,0 @@ -version: 2 - -issues: - exclude-rules: - - text: "undefined: extract" \ No newline at end of file