Skip to content

Commit

Permalink
fix linting issues
Browse files Browse the repository at this point in the history
Signed-off-by: Efertone <efertone@pm.me>
  • Loading branch information
yitsushi committed Jul 18, 2023
1 parent 9e2d93b commit 643d16c
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 21 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/quality-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v3
with:
go-version: ^1.19
go-version: ^1.20

- name: Get dependencies
run: |
Expand Down Expand Up @@ -43,7 +43,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v3
with:
go-version: ^1.19
go-version: ^1.20

- name: Get dependencies
run: |
Expand All @@ -66,4 +66,4 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.51.0
version: v1.52.0
10 changes: 6 additions & 4 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,16 @@ issues:
- path: internal/cmd/
linters:
- forbidigo
- text: "sig: func github.com/yitsushi/totp-cli/"
linters:
- wrapcheck
- text: "sig: func \\(\\*?github.com/yitsushi/totp-cli/"
linters:
- wrapcheck

linters:
enable-all: true
disable:
# Go Generics
- rowserrcheck
- sqlclosecheck
- wastedassign
# Deprecated
- interfacer
- nosnakecase
Expand Down
1 change: 1 addition & 0 deletions app.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"os"

"github.com/urfave/cli/v2"

"github.com/yitsushi/totp-cli/internal/cmd"
"github.com/yitsushi/totp-cli/internal/info"
)
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/yitsushi/totp-cli

go 1.19
go 1.20

require (
filippo.io/age v1.1.1
Expand Down
9 changes: 2 additions & 7 deletions internal/cmd/change_password.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package cmd

import (
"fmt"
"os"

"github.com/urfave/cli/v2"
Expand Down Expand Up @@ -38,16 +37,12 @@ func ChangePasswordCommand() *cli.Command {
}

if !CheckPasswordConfirm([]byte(newPasswordIn), []byte(newPasswordConfirmIn)) {
return fmt.Errorf("New Password and the confirm mismatch!")
return CommandError{Message: "new password and the confirm mismatch"}
}

storage.Password = newPasswordIn

if err = storage.Save(); err != nil {
return err
}

return nil
return storage.Save()
},
}
}
4 changes: 2 additions & 2 deletions internal/cmd/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const (
argPositionAccount = 1
argPositionPrefix = 2

strictDumpFilePerms = 0600

binaryChmodValue = 0o755

strictDumpFilePerms = 0o600
)
6 changes: 4 additions & 2 deletions internal/cmd/dump.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package cmd

import (
"fmt"
"os"

"github.com/urfave/cli/v2"
Expand All @@ -11,6 +12,7 @@ import (

func DumpCommand() *cli.Command {

Check failure on line 13 in internal/cmd/dump.go

View workflow job for this annotation

GitHub Actions / go vet and lint

exported function DumpCommand should have comment or be unexported

Check failure on line 13 in internal/cmd/dump.go

View workflow job for this annotation

GitHub Actions / go vet and lint

exported function DumpCommand should have comment or be unexported
warningMsg := "The output is NOT encrypted. Use this flag to verify you really want to dump all secrets."

return &cli.Command{
Name: "dump",
Usage: "Dump all available accounts under all namespaces.",
Expand Down Expand Up @@ -41,11 +43,11 @@ func DumpCommand() *cli.Command {

out, err := yaml.Marshal(storage.Namespaces)
if err != nil {
return err
return fmt.Errorf("failed to marshal storage: %w", err)
}

if err := os.WriteFile(ctx.String("output"), out, strictDumpFilePerms); err != nil {
return err
return fmt.Errorf("failed to write output file: %w", err)
}

return nil
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func GenerateCommand() *cli.Command {
&cli.BoolFlag{
Name: "follow",
Value: false,
Usage: "Generate codes continously.",
Usage: "Generate codes continuously.",
},
},
Usage: "Generate a specific OTP",
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func ListCommand() *cli.Command {
Action: func(ctx *cli.Context) error {
storage, err := s.PrepareStorage()
if err != nil {
return nil
return err
}

ns := ctx.Args().Get(argPositionNamespace)
Expand Down

0 comments on commit 643d16c

Please sign in to comment.