-
-
Save levrik/99210259065679da20c3c66ef383eea9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"os" | |
"golang.org/x/crypto/ssh/terminal" | |
) | |
func main() { | |
fmt.Print("Enter password for test-user: ") | |
res, err := terminal.ReadPassword(int(os.Stdin.Fd())) | |
if err != nil { | |
fmt.Fprintf(os.Stderr, "\nFailed to read password: %s\n", err) | |
os.Exit(1) | |
} | |
fmt.Println(string(res)) | |
fmt.Println() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment