Skip to content

Commit

Permalink
Flags should be defined as a side-effect of running Main, not importi…
Browse files Browse the repository at this point in the history
…ng the package
  • Loading branch information
pdmccormick authored and ignatk committed Apr 29, 2024
1 parent 33090d8 commit 3b069e1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cmd/gokey/gokeycmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ var (
seedSkipCount, length int
)

func init() {
func initFlags() {
flag.StringVar(&pass, "p", "", "master password (if not specified, will be asked interactively)")
flag.StringVar(&passFile, "P", "", "master password file (if not specified, will be asked interactively)")
flag.StringVar(&keyType, "t", "pass", "output type (can be pass, seed, raw, ec256, ec384, ec521, rsa2048, rsa4096, x25519, ed25519)")
Expand Down Expand Up @@ -108,6 +108,7 @@ func logFatal(format string, args ...interface{}) {
}

func Main() {
initFlags()
flag.Parse()

var err error
Expand Down

0 comments on commit 3b069e1

Please sign in to comment.