Apply linter autofixes: internal/vaultik (refs #61)

This commit is contained in:
sneak committed 2026-08-07 16:53:23 +00:00
1 parent 0296e26210
commit 82eb352eb5
21 files changed
+730 -108

No files matched your search

+7 -2
View File
@@ -3,6 +3,7 @@ package vaultik
import (
"bytes"
"context"
"errors"
"fmt"
"io"
"os"
@@ -125,8 +126,9 @@ func (v *Vaultik) CanDecrypt() bool {
// Returns an error if no recipients are configured
func (v *Vaultik) GetEncryptor() (*crypto.Encryptor, error) {
if len(v.Config.AgeRecipients) == 0 {
return nil, fmt.Errorf("no age recipients configured")
return nil, errors.New("no age recipients configured")
}
return crypto.NewEncryptor(v.Config.AgeRecipients)
}
@@ -134,8 +136,9 @@ func (v *Vaultik) GetEncryptor() (*crypto.Encryptor, error) {
// Returns an error if no secret key is configured
func (v *Vaultik) GetDecryptor() (*crypto.Decryptor, error) {
if v.Config.AgeSecretKey == "" {
return nil, fmt.Errorf("no age secret key configured")
return nil, errors.New("no age secret key configured")
}
return crypto.NewDecryptor(v.Config.AgeSecretKey)
}
@@ -162,6 +165,7 @@ func (v *Vaultik) scanStdin(a ...any) (int, error) {
// TestVaultik wraps a Vaultik with captured stdout/stderr for testing
type TestVaultik struct {
*Vaultik
Stdout *bytes.Buffer
Stderr *bytes.Buffer
Stdin *bytes.Buffer
@@ -175,6 +179,7 @@ func NewForTesting(storage storage.Storer) *TestVaultik {
stdout := &bytes.Buffer{}
stderr := &bytes.Buffer{}
stdin := &bytes.Buffer{}
return &TestVaultik{
Vaultik: &Vaultik{
Storage: storage,