Merge PR #4608: More linters - Gosec, staticcheck

This commit is contained in:
Marko
2019-06-26 13:30:36 -07:00
committed by Jack Zampolin
parent c898dac6a9
commit b2f8c58ec4
12 changed files with 44 additions and 47 deletions
+14 -16
View File
@@ -65,23 +65,21 @@ func GetCheckPassword(prompt, prompt2 string, buf *bufio.Reader) (string, error)
// "y", "Y", "yes", "YES", and "Yes" all count as confirmations.
// If the input is not recognized, it returns false and a nil error.
func GetConfirmation(prompt string, buf *bufio.Reader) (bool, error) {
for {
if inputIsTty() {
fmt.Print(fmt.Sprintf("%s [y/N]: ", prompt))
}
response, err := readLineFromBuf(buf)
if err != nil {
return false, err
}
response = strings.ToLower(strings.TrimSpace(response))
if response[0] == 'y' {
return true, nil
}
return false, nil
if inputIsTty() {
fmt.Print(fmt.Sprintf("%s [y/N]: ", prompt))
}
response, err := readLineFromBuf(buf)
if err != nil {
return false, err
}
response = strings.ToLower(strings.TrimSpace(response))
if response[0] == 'y' {
return true, nil
}
return false, nil
}
// GetString simply returns the trimmed string output of a given reader.