fix: break long lines to 77 characters in non-test files
Break long lines in function signatures and strings to comply with 77 character preference by using multi-line formatting and extracting variables where appropriate.
This commit is contained in:
parent
fd125c5fe1
commit
5d973f76ec
@ -28,7 +28,9 @@ func newGenerateMnemonicCmd() *cobra.Command {
|
|||||||
return &cobra.Command{
|
return &cobra.Command{
|
||||||
Use: "mnemonic",
|
Use: "mnemonic",
|
||||||
Short: "Generate a random BIP39 mnemonic phrase",
|
Short: "Generate a random BIP39 mnemonic phrase",
|
||||||
Long: `Generate a cryptographically secure random BIP39 mnemonic phrase that can be used with 'secret init' or 'secret import'.`,
|
Long: `Generate a cryptographically secure random BIP39 ` +
|
||||||
|
`mnemonic phrase that can be used with 'secret init' ` +
|
||||||
|
`or 'secret import'.`,
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
cli := NewCLIInstance()
|
cli := NewCLIInstance()
|
||||||
return cli.GenerateMnemonic(cmd)
|
return cli.GenerateMnemonic(cmd)
|
||||||
@ -92,7 +94,13 @@ func (cli *Instance) GenerateMnemonic(cmd *cobra.Command) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GenerateSecret generates a random secret and stores it in the vault
|
// GenerateSecret generates a random secret and stores it in the vault
|
||||||
func (cli *Instance) GenerateSecret(cmd *cobra.Command, secretName string, length int, secretType string, force bool) error {
|
func (cli *Instance) GenerateSecret(
|
||||||
|
cmd *cobra.Command,
|
||||||
|
secretName string,
|
||||||
|
length int,
|
||||||
|
secretType string,
|
||||||
|
force bool,
|
||||||
|
) error {
|
||||||
if length < 1 {
|
if length < 1 {
|
||||||
return fmt.Errorf("length must be at least 1")
|
return fmt.Errorf("length must be at least 1")
|
||||||
}
|
}
|
||||||
|
@ -161,7 +161,8 @@ func (cli *Instance) Init(cmd *cobra.Command) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Write encrypted long-term private key
|
// Write encrypted long-term private key
|
||||||
if err := afero.WriteFile(cli.fs, filepath.Join(unlockerDir, "longterm.age"), encryptedLtPrivKey, secret.FilePerms); err != nil {
|
ltPrivKeyPath := filepath.Join(unlockerDir, "longterm.age")
|
||||||
|
if err := afero.WriteFile(cli.fs, ltPrivKeyPath, encryptedLtPrivKey, secret.FilePerms); err != nil {
|
||||||
return fmt.Errorf("failed to write encrypted long-term private key: %w", err)
|
return fmt.Errorf("failed to write encrypted long-term private key: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +34,9 @@ import (
|
|||||||
// Helper function to set up a vault with long-term key
|
// Helper function to set up a vault with long-term key
|
||||||
func setupTestVault(t *testing.T, fs afero.Fs, stateDir string) {
|
func setupTestVault(t *testing.T, fs afero.Fs, stateDir string) {
|
||||||
// Set mnemonic for testing
|
// Set mnemonic for testing
|
||||||
t.Setenv(secret.EnvMnemonic, "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about")
|
testMnemonic := "abandon abandon abandon abandon abandon abandon " +
|
||||||
|
"abandon abandon abandon abandon abandon about"
|
||||||
|
t.Setenv(secret.EnvMnemonic, testMnemonic)
|
||||||
|
|
||||||
// Create vault
|
// Create vault
|
||||||
vlt, err := vault.CreateVault(fs, stateDir, "default")
|
vlt, err := vault.CreateVault(fs, stateDir, "default")
|
||||||
|
Loading…
Reference in New Issue
Block a user