fix: resolve all revive linter issues

Added missing package comments:
- cmd/secret/main.go
- internal/cli/cli.go
- internal/secret/constants.go
- internal/vault/management.go
- pkg/bip85/bip85.go

Fixed comment format issues for exported items:
- EnvStateDir, EnvMnemonic, EnvUnlockPassphrase, EnvGPGKeyID in constants.go
- Metadata, UnlockerMetadata, SecretMetadata, Configuration in metadata.go
- AppBIP39, AppHDWIF, AppXPRV in bip85.go

Replaced unused parameters with underscore (_):
- generate.go:39 - parameter 'args'
- init.go:30 - parameter 'args'
- unlockers.go:39,77,102 - parameter 'args' or 'cmd'
- vault.go:37 - parameter 'args'
- management.go:34 - parameter 'target'
This commit is contained in:
Jeffrey Paul 2025-07-15 06:06:48 +02:00
parent 080a3dc253
commit 386a27c0b6
10 changed files with 36 additions and 22 deletions

View File

@ -1,3 +1,4 @@
// Package main is the entry point for the secret CLI application.
package main package main
import "git.eeqj.de/sneak/secret/internal/cli" import "git.eeqj.de/sneak/secret/internal/cli"

View File

@ -1,3 +1,4 @@
// Package cli implements the command-line interface for the secret application.
package cli package cli
import ( import (

View File

@ -36,7 +36,7 @@ func newGenerateMnemonicCmd() *cobra.Command {
Long: `Generate a cryptographically secure random BIP39 ` + Long: `Generate a cryptographically secure random BIP39 ` +
`mnemonic phrase that can be used with 'secret init' ` + `mnemonic phrase that can be used with 'secret init' ` +
`or 'secret import'.`, `or 'secret import'.`,
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, _ []string) error {
cli := NewCLIInstance() cli := NewCLIInstance()
return cli.GenerateMnemonic(cmd) return cli.GenerateMnemonic(cmd)

View File

@ -27,7 +27,7 @@ func NewInitCmd() *cobra.Command {
} }
// RunInit is the exported function that handles the init command // RunInit is the exported function that handles the init command
func RunInit(cmd *cobra.Command, args []string) error { func RunInit(cmd *cobra.Command, _ []string) error {
cli := NewCLIInstance() cli := NewCLIInstance()
return cli.Init(cmd) return cli.Init(cmd)

View File

@ -36,7 +36,7 @@ func newUnlockersListCmd() *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "list", Use: "list",
Short: "List unlockers in the current vault", Short: "List unlockers in the current vault",
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, _ []string) error {
jsonOutput, _ := cmd.Flags().GetBool("json") jsonOutput, _ := cmd.Flags().GetBool("json")
cli := NewCLIInstance() cli := NewCLIInstance()
@ -74,7 +74,7 @@ func newUnlockersRmCmd() *cobra.Command {
Use: "rm <unlocker-id>", Use: "rm <unlocker-id>",
Short: "Remove an unlocker", Short: "Remove an unlocker",
Args: cobra.ExactArgs(1), Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(_ *cobra.Command, args []string) error {
cli := NewCLIInstance() cli := NewCLIInstance()
return cli.UnlockersRemove(args[0]) return cli.UnlockersRemove(args[0])
@ -99,7 +99,7 @@ func newUnlockerSelectSubCmd() *cobra.Command {
Use: "select <unlocker-id>", Use: "select <unlocker-id>",
Short: "Select an unlocker as current", Short: "Select an unlocker as current",
Args: cobra.ExactArgs(1), Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(_ *cobra.Command, args []string) error {
cli := NewCLIInstance() cli := NewCLIInstance()
return cli.UnlockerSelect(args[0]) return cli.UnlockerSelect(args[0])

View File

@ -34,7 +34,7 @@ func newVaultListCmd() *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "list", Use: "list",
Short: "List available vaults", Short: "List available vaults",
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, _ []string) error {
jsonOutput, _ := cmd.Flags().GetBool("json") jsonOutput, _ := cmd.Flags().GetBool("json")
cli := NewCLIInstance() cli := NewCLIInstance()

View File

@ -1,3 +1,4 @@
// Package secret provides core types and constants for the secret application.
package secret package secret
import "os" import "os"
@ -6,10 +7,13 @@ const (
// AppID is the unique identifier for this application // AppID is the unique identifier for this application
AppID = "berlin.sneak.pkg.secret" AppID = "berlin.sneak.pkg.secret"
// Environment variable names // EnvStateDir is the environment variable for specifying the state directory
EnvStateDir = "SB_SECRET_STATE_DIR" EnvStateDir = "SB_SECRET_STATE_DIR"
// EnvMnemonic is the environment variable for providing the mnemonic phrase
EnvMnemonic = "SB_SECRET_MNEMONIC" EnvMnemonic = "SB_SECRET_MNEMONIC"
// EnvUnlockPassphrase is the environment variable for providing the unlock passphrase
EnvUnlockPassphrase = "SB_UNLOCK_PASSPHRASE" //nolint:gosec // G101: This is an env var name, not a credential EnvUnlockPassphrase = "SB_UNLOCK_PASSPHRASE" //nolint:gosec // G101: This is an env var name, not a credential
// EnvGPGKeyID is the environment variable for providing the GPG key ID
EnvGPGKeyID = "SB_GPG_KEY_ID" EnvGPGKeyID = "SB_GPG_KEY_ID"
) )

View File

@ -1,3 +1,4 @@
// Package vault provides functionality for managing encrypted vaults.
package vault package vault
import ( import (
@ -31,7 +32,7 @@ func isValidVaultName(name string) bool {
} }
// resolveRelativeSymlink resolves a relative symlink target to an absolute path // resolveRelativeSymlink resolves a relative symlink target to an absolute path
func resolveRelativeSymlink(symlinkPath, target string) (string, error) { func resolveRelativeSymlink(symlinkPath, _ string) (string, error) {
// Get the current directory before changing // Get the current directory before changing
originalDir, err := os.Getwd() originalDir, err := os.Getwd()
if err != nil { if err != nil {

View File

@ -12,13 +12,17 @@ import (
"github.com/spf13/afero" "github.com/spf13/afero"
) )
// Alias the metadata types from secret package for convenience // Metadata is an alias for secret.VaultMetadata
type ( type Metadata = secret.VaultMetadata
Metadata = secret.VaultMetadata
UnlockerMetadata = secret.UnlockerMetadata // UnlockerMetadata is an alias for secret.UnlockerMetadata
SecretMetadata = secret.Metadata type UnlockerMetadata = secret.UnlockerMetadata
Configuration = secret.Configuration
) // SecretMetadata is an alias for secret.Metadata
type SecretMetadata = secret.Metadata
// Configuration is an alias for secret.Configuration
type Configuration = secret.Configuration
// ComputeDoubleSHA256 computes the double SHA256 hash of data and returns it as hex // ComputeDoubleSHA256 computes the double SHA256 hash of data and returns it as hex
func ComputeDoubleSHA256(data []byte) string { func ComputeDoubleSHA256(data []byte) string {

View File

@ -1,3 +1,4 @@
// Package bip85 implements BIP85 deterministic entropy derivation.
package bip85 package bip85
import ( import (
@ -27,10 +28,12 @@ const (
// BIP85_KEY_HMAC_KEY is the HMAC key used for deriving the entropy // BIP85_KEY_HMAC_KEY is the HMAC key used for deriving the entropy
BIP85_KEY_HMAC_KEY = "bip-entropy-from-k" //nolint:revive // ALL_CAPS used for BIP85 constants BIP85_KEY_HMAC_KEY = "bip-entropy-from-k" //nolint:revive // ALL_CAPS used for BIP85 constants
// Application numbers // AppBIP39 is the application number for BIP39 mnemonics
AppBIP39 = 39 // BIP39 mnemonics AppBIP39 = 39
AppHDWIF = 2 // WIF for Bitcoin Core // AppHDWIF is the application number for WIF (Wallet Import Format) for Bitcoin Core
AppXPRV = 32 // Extended private key AppHDWIF = 2
// AppXPRV is the application number for extended private key
AppXPRV = 32
APP_HEX = 128169 //nolint:revive // ALL_CAPS used for BIP85 constants APP_HEX = 128169 //nolint:revive // ALL_CAPS used for BIP85 constants
APP_PWD64 = 707764 // Base64 passwords //nolint:revive // ALL_CAPS used for BIP85 constants APP_PWD64 = 707764 // Base64 passwords //nolint:revive // ALL_CAPS used for BIP85 constants
AppPWD85 = 707785 // Base85 passwords AppPWD85 = 707785 // Base85 passwords