func readPassword(prompt string) (password string, err error) { if acceptPasswordFromStdin && !isTerminalIn { _, err = fmt.Scanln(&password) return } // NOTE: speakeasy may not support multi-byte chars on Windows return speakeasy.Ask("Enter password: ") }
func main() { password, err := speakeasy.Ask("Please enter a password: "******"Password result: %q\n", password) fmt.Printf("Password len: %d\n", len(password)) }