Skip to content

Commit

Permalink
feat(proxy): fix lint errors go1.22 (#116)
Browse files Browse the repository at this point in the history
  • Loading branch information
plastikfan committed Apr 27, 2024
1 parent c8f3ded commit d818bd0
Show file tree
Hide file tree
Showing 25 changed files with 106 additions and 102 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/ci-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,35 @@ jobs:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v5
- uses: actions/setup-go@v3
with:
go-version: 1.21
- uses: actions/checkout@v4
go-version: 1.22
- uses: actions/checkout@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v4
with:
version: v1.54.2
version: v1.56.2
args: --verbose

test:
strategy:
matrix:
go-version: [1.21]
go-version: [1.22]
platform: [ubuntu-latest, macos-latest]

runs-on: ${{ matrix.platform }}

steps:
- name: Install Go
uses: actions/setup-go@v5
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}

- name: Install goveralls
run: go install github.com/mattn/goveralls@latest

- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v3

- run: go test -v -coverprofile=coverage.out ./...

Expand Down
4 changes: 2 additions & 2 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"--",
"shrink",
"/Users/plastikfan/dev/test/pics",
"--profile",
"blur",
"--scheme",
"blur-sf",
"--files",
"wonky*",
"--dry-run",
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/snivilised/pixa

go 1.21
go 1.22

require (
github.com/charmbracelet/bubbletea v0.25.0
Expand Down
8 changes: 4 additions & 4 deletions src/app/cfg/cfg-suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ package cfg_test
import (
"testing"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/onsi/ginkgo/v2"
"github.com/onsi/gomega"
)

func TestCfg(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Cfg Suite")
gomega.RegisterFailHandler(ginkgo.Fail)
ginkgo.RunSpecs(t, "Cfg Suite")
}
4 changes: 2 additions & 2 deletions src/app/cfg/config-runner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"fmt"
"path/filepath"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
. "github.com/onsi/ginkgo/v2" //nolint:revive // foo
. "github.com/onsi/gomega" //nolint:revive // foo
"github.com/spf13/viper"
"go.uber.org/mock/gomock"

Expand Down
2 changes: 1 addition & 1 deletion src/app/command/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func (b *Bootstrap) Root(options ...ConfigureOptionFn) *cobra.Command {
Short: xi18n.Text(i18n.RootCmdShortDescTemplData{}),
Long: xi18n.Text(i18n.RootCmdLongDescTemplData{}),
Version: fmt.Sprintf("'%v'", Version),
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(_ *cobra.Command, args []string) error {
inputs := b.getRootInputs()

if len(args) == 0 {
Expand Down
4 changes: 2 additions & 2 deletions src/app/command/bootstrap_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package command_test

import (
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
. "github.com/onsi/ginkgo/v2" //nolint:revive // foo
. "github.com/onsi/gomega" //nolint:revive // foo
"github.com/snivilised/cobrass/src/assistant/configuration"
"github.com/snivilised/extendio/xfs/storage"
"github.com/snivilised/pixa/src/app/command"
Expand Down
8 changes: 4 additions & 4 deletions src/app/command/command_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ package command_test
import (
"testing"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/onsi/ginkgo/v2"
"github.com/onsi/gomega"
)

func TestCommand(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Command Suite")
gomega.RegisterFailHandler(ginkgo.Fail)
ginkgo.RunSpecs(t, "Command Suite")
}
2 changes: 1 addition & 1 deletion src/app/command/magick-cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func (b *Bootstrap) buildMagickCommand(container *assistant.CobraContainer) *cob

// optionally invoke cross field validation
//
if xv := ps.CrossValidate(func(ps *MagickParameterSet) error {
if xv := ps.CrossValidate(func(_ *MagickParameterSet) error {
return nil
}); xv == nil {
options := []string{}
Expand Down
4 changes: 2 additions & 2 deletions src/app/command/magick-cmd_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package command_test

import (
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
. "github.com/onsi/ginkgo/v2" //nolint:revive // foo
. "github.com/onsi/gomega" //nolint:revive // foo

"github.com/snivilised/cobrass/src/assistant/configuration"
xi18n "github.com/snivilised/extendio/i18n"
Expand Down
4 changes: 2 additions & 2 deletions src/app/command/root-cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package command_test
import (
"fmt"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
. "github.com/onsi/ginkgo/v2" //nolint:revive // foo
. "github.com/onsi/gomega" //nolint:revive // foo

"github.com/snivilised/extendio/xfs/storage"
"github.com/snivilised/pixa/src/app/command"
Expand Down
13 changes: 6 additions & 7 deletions src/app/command/shrink-cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func (b *Bootstrap) buildShrinkCommand(container *assistant.CobraContainer) *cob
if validationErr := shrinkPS.Validate(); validationErr == nil {
// optionally invoke cross field validation
//
if xvErr := shrinkPS.CrossValidate(func(ps *common.ShrinkParameterSet) error {
if xvErr := shrinkPS.CrossValidate(func(_ *common.ShrinkParameterSet) error {
// cross validation not currently required
//
return nil
Expand Down Expand Up @@ -171,14 +171,13 @@ func (b *Bootstrap) buildShrinkCommand(container *assistant.CobraContainer) *cob
xi18n.Text(i18n.ShrinkCmdOutputPathParamUsageTemplData{}),
defaultOutputPath,
),
&paramSet.Native.OutputPath, func(s string, f *pflag.Flag) error {
// Instead of doing the commented out check, check that the location
&paramSet.Native.OutputPath, func(_ string, _ *pflag.Flag) error {
// todo: Instead of doing the commented out check, check that the location
// specified has the correct permission to write
//
// if f.Changed && !b.Vfs.DirectoryExists(s) {
// return i18n.NewOutputPathDoesNotExistError(s)
// }

return nil
},
)
Expand All @@ -194,14 +193,13 @@ func (b *Bootstrap) buildShrinkCommand(container *assistant.CobraContainer) *cob
xi18n.Text(i18n.ShrinkCmdTrashPathParamUsageTemplData{}),
defaultTrashPath,
),
&paramSet.Native.TrashPath, func(s string, f *pflag.Flag) error {
// Instead of doing the commented out check, check that the location
&paramSet.Native.TrashPath, func(_ string, _ *pflag.Flag) error {
// todo: Instead of doing the commented out check, check that the location
// specified has the correct permission to write
//
// if f.Changed && !b.Vfs.DirectoryExists(s) {
// return i18n.NewOutputPathDoesNotExistError(s)
// }

return nil
},
)
Expand Down Expand Up @@ -258,6 +256,7 @@ func (b *Bootstrap) buildShrinkCommand(container *assistant.CobraContainer) *cob

return i18n.NewInvalidSamplingFactorError(value, acceptableSet)
}

return nil
},
)
Expand Down
4 changes: 2 additions & 2 deletions src/app/command/shrink-cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package command_test
import (
"fmt"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
. "github.com/onsi/ginkgo/v2" //nolint:revive // foo
. "github.com/onsi/gomega" //nolint:revive // foo
"github.com/snivilised/cobrass/src/assistant/configuration"
"github.com/snivilised/pixa/src/app/cfg"
"github.com/snivilised/pixa/src/app/command"
Expand Down
2 changes: 1 addition & 1 deletion src/app/proxy/enter-root.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func (e *RootEntry) run() (*nav.TraverseResult, error) {
//
var nilResumption *nav.Resumption

after := func(result *nav.TraverseResult, _ error) {
after := func(_ *nav.TraverseResult, _ error) {
for _, file := range e.files {
e.Log.Info("📒 candidate file: '%v'",
slog.String("file", file),
Expand Down
2 changes: 1 addition & 1 deletion src/app/proxy/enter-shrink.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ func (e *ShrinkEntry) run() (result *nav.TraverseResult, err error) {
// the user can select.
//
RestorePath: "/json-path-to-come-from-a-flag-option/restore.json",
Restorer: func(o *nav.TraverseOptions, active *nav.ActiveState) {
Restorer: func(o *nav.TraverseOptions, _ *nav.ActiveState) {
o.Callback = &nav.LabelledTraverseCallback{
Label: "Resume Shrink Entry Callback",
Fn: e.resumeFn,
Expand Down
2 changes: 1 addition & 1 deletion src/app/proxy/entry-base.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func (e *EntryBase) ConfigureOptions(o *nav.TraverseOptions) {
trash := statics.TrashTag()
sample := fmt.Sprintf("$%v$", statics.Sample) // PathFinder.FileSupplement

return lo.Filter(contents, func(item fs.DirEntry, index int) bool {
return lo.Filter(contents, func(item fs.DirEntry, _ int) bool {
name := item.Name()

return !strings.HasPrefix(name, ".") &&
Expand Down
5 changes: 3 additions & 2 deletions src/app/proxy/filing/file-manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,9 @@ func (fm *FileManager) Create(path string, overwrite bool) error {
func (fm *FileManager) Setup(pi *common.PathInfo) (destination string, err error) {
if !fm.finder.TransparentInput() {
// Any result file must not clash with the input file, so the input
// file must stay in place.
// todo: if --trash is specified, then the input must be moved there
// file can stay in place.
// todo: if --trash is specified, then the input must be moved there, escape
// out of this condition so that Transfer can be invoked (pi.Trash != "")
//
return pi.Item.Path, nil
}
Expand Down
4 changes: 2 additions & 2 deletions src/app/proxy/filing/filing_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package filing_test
import (
"testing"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
. "github.com/onsi/ginkgo/v2" //nolint:revive // foo
. "github.com/onsi/gomega" //nolint:revive // foo
)

func TestFiling(t *testing.T) {
Expand Down
Loading

0 comments on commit d818bd0

Please sign in to comment.