Skip to content

Commit

Permalink
Fixing the new lint issues in 1.61.0
Browse files Browse the repository at this point in the history
Signed-off-by: Yolan Romailler <AnomalRoil@users.noreply.github.com>
  • Loading branch information
AnomalRoil committed Sep 25, 2024
1 parent 9f74b32 commit aae1dea
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ linters:
- errname
- errorlint
- exhaustive
- exportloopref
# - exportloopref # deprecated since Go 1.22
- forcetypeassert
- funlen
- ginkgolinter
Expand Down
6 changes: 3 additions & 3 deletions internal/action/show.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ func (s *Action) showHandleOutput(ctx context.Context, name string, sec gopass.S
out.Warning(ctx, "show.safecontent=true. Use -f to display password, if any")
}

return exit.Error(exit.NotFound, store.ErrEmptySecret, store.ErrEmptySecret.Error())
return exit.Error(exit.NotFound, store.ErrEmptySecret, "%v", store.ErrEmptySecret)
}

if IsPrintQR(ctx) && IsQRBody(ctx) {
Expand Down Expand Up @@ -244,7 +244,7 @@ func (s *Action) showGetContent(ctx context.Context, sec gopass.Secret) (string,
key := GetKey(ctx)
values, found := sec.Values(key)
if !found {
return "", "", exit.Error(exit.NotFound, store.ErrNoKey, store.ErrNoKey.Error())
return "", "", exit.Error(exit.NotFound, store.ErrNoKey, "%v", store.ErrNoKey)
}
val := strings.Join(values, "\n")

Expand All @@ -264,7 +264,7 @@ func (s *Action) showGetContent(ctx context.Context, sec gopass.Secret) (string,
}
if IsPasswordOnly(ctx) {
if pw == "" && fullBody != "" {
return "", "", exit.Error(exit.NotFound, store.ErrNoPassword, store.ErrNoPassword.Error())
return "", "", exit.Error(exit.NotFound, store.ErrNoPassword, "%v", store.ErrNoPassword)
}

return pw, pw, nil
Expand Down
2 changes: 1 addition & 1 deletion internal/backend/crypto/gpg/key.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func (k Key) String() string {

out += "\n Key fingerprint = " + k.Fingerprint
for _, id := range k.Identities {
out += fmt.Sprintf("\n" + id.String())
out += fmt.Sprintf("\n%s", id)
}

return out
Expand Down
2 changes: 1 addition & 1 deletion internal/store/leaf/recipients_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func TestSaveRecipients(t *testing.T) {
sort.Strings(foundRecs)

ids := rs.IDs()
for i := range len(ids) {
for i := range ids {
if i >= len(foundRecs) {
t.Errorf("Read too few recipients")

Expand Down
3 changes: 2 additions & 1 deletion pkg/clipboard/clipboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ var (
// -ldflags=='-X github.com/gopasspw/gopass/pkg/clipboard.Helpers=termux-api'.
Helpers = "xsel or xclip"
// ErrNotSupported is returned when the clipboard is not accessible.
ErrNotSupported = fmt.Errorf("WARNING: No clipboard available. Install " + Helpers + ", provide $GOPASS_CLIPBOARD_COPY_CMD and $GOPASS_CLIPBOARD_CLEAR_CMD or use -f to print to console")
ErrNotSupported = fmt.Errorf("WARNING: No clipboard available. "+
"Install %s, provide $GOPASS_CLIPBOARD_COPY_CMD and $GOPASS_CLIPBOARD_CLEAR_CMD or use -f to print to console", Helpers)
)

// CopyTo copies the given data to the clipboard and enqueues automatic
Expand Down
14 changes: 7 additions & 7 deletions tests/tester.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,13 @@ func newTester(t *testing.T) *tester {

// prepare ENVIRONMENT
ts.resetFn = gptest.UnsetVars("GNUPGHOME", "GOPASS_DEBUG", "NO_COLOR", "GOPASS_CONFIG", "GOPASS_NO_NOTIFY", "GOPASS_HOMEDIR")
require.NoError(t, os.Setenv("GNUPGHOME", ts.gpgDir()))
require.NoError(t, os.Setenv("GOPASS_DEBUG", ""))
require.NoError(t, os.Setenv("NO_COLOR", "true"))
require.NoError(t, os.Setenv("GOPASS_CONFIG_NOSYSTEM", "true"))
require.NoError(t, os.Setenv("GOPASS_CONFIG_NO_MIGRATE", "true"))
require.NoError(t, os.Setenv("GOPASS_NO_NOTIFY", "true"))
require.NoError(t, os.Setenv("GOPASS_HOMEDIR", td))
t.Setenv("GNUPGHOME", ts.gpgDir())
t.Setenv("GOPASS_DEBUG", "")
t.Setenv("NO_COLOR", "true")
t.Setenv("GOPASS_CONFIG_NOSYSTEM", "true")
t.Setenv("GOPASS_CONFIG_NO_MIGRATE", "true")
t.Setenv("GOPASS_NO_NOTIFY", "true")
t.Setenv("GOPASS_HOMEDIR", td)

// write config
require.NoError(t, os.MkdirAll(filepath.Dir(ts.gopassConfig()), 0o700))
Expand Down

0 comments on commit aae1dea

Please sign in to comment.