style: заменить короткие имена переменных

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
2026-08-09 00:32:32 +03:00
parent 3f59a97844
commit 3950dd94ee
4 changed files with 73 additions and 71 deletions
+13 -11
View File
@@ -68,12 +68,14 @@ func newKeygenCmdWithDeps(reg crypto.Registry) *cobra.Command {
}
if !force {
for _, s := range schemes {
pubPath := outPrefix + "." + s.name + ".pub.pem"
privPath := outPrefix + "." + s.name + ".priv.pem"
for _, p := range []string{pubPath, privPath} {
if _, err := os.Stat(p); err == nil {
return fmt.Errorf("file already exists: %s (use --force to overwrite)", p)
for _, scheme := range schemes {
pubPath := outPrefix + "." + scheme.name + ".pub.pem"
privPath := outPrefix + "." + scheme.name + ".priv.pem"
paths := make([]string, 0, 2)
paths = append(paths, pubPath, privPath)
for _, path := range paths {
if _, err := os.Stat(path); err == nil {
return fmt.Errorf("file already exists: %s (use --force to overwrite)", path)
}
}
}
@@ -81,9 +83,9 @@ func newKeygenCmdWithDeps(reg crypto.Registry) *cobra.Command {
km := keymanager.NewKeyManager(reg)
for _, s := range schemes {
pubPath := outPrefix + "." + s.name + ".pub.pem"
privPath := outPrefix + "." + s.name + ".priv.pem"
for _, scheme := range schemes {
pubPath := outPrefix + "." + scheme.name + ".pub.pem"
privPath := outPrefix + "." + scheme.name + ".priv.pem"
pubFile, err := os.OpenFile(pubPath, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0o644)
if err != nil {
@@ -96,10 +98,10 @@ func newKeygenCmdWithDeps(reg crypto.Registry) *cobra.Command {
return fmt.Errorf("create private key file %s: %w", privPath, err)
}
if err := km.Generate(s.schemeID, pubFile, privFile, rand.Reader); err != nil {
if err := km.Generate(scheme.schemeID, pubFile, privFile, rand.Reader); err != nil {
_ = pubFile.Close()
_ = privFile.Close()
return fmt.Errorf("generate %s keys: %w", s.name, err)
return fmt.Errorf("generate %s keys: %w", scheme.name, err)
}
if err := pubFile.Close(); err != nil {