Fix gometalinter warnings

This commit is contained in:
Eugene Bujak 2018-11-28 13:37:42 +03:00
parent aa3f3e2c43
commit 6257ff123f
4 changed files with 6 additions and 19 deletions

6
app.go
View File

@ -202,7 +202,7 @@ func getInput() (string, error) {
func promptAndGet(prompt string) (string, error) {
for {
fmt.Printf(prompt)
fmt.Print(prompt)
input, err := getInput()
if err != nil {
log.Printf("Failed to get input, aborting: %s", err)
@ -217,9 +217,9 @@ func promptAndGet(prompt string) (string, error) {
func promptAndGetPassword(prompt string) (string, error) {
for {
fmt.Printf(prompt)
fmt.Print(prompt)
password, err := terminal.ReadPassword(int(os.Stdin.Fd()))
fmt.Printf("\n")
fmt.Print("\n")
if err != nil {
log.Printf("Failed to get input, aborting: %s", err)
return "", err

View File

@ -669,12 +669,7 @@ func (filter *filter) save() error {
filterFilePath := filter.Path()
log.Printf("Saving filter %d contents to: %s", filter.ID, filterFilePath)
err := safeWriteFile(filterFilePath, filter.Contents)
if err != nil {
return err
}
return nil
return safeWriteFile(filterFilePath, filter.Contents)
}
// loads filter contents from the file in dataDir

View File

@ -31,12 +31,7 @@ func safeWriteFile(path string, data []byte) error {
if err != nil {
return err
}
err = os.Rename(tmpPath, path)
if err != nil {
return err
}
return nil
return os.Rename(tmpPath, path)
}
// ----------------------------------

View File

@ -24,10 +24,7 @@ var allowedLanguages = map[string]bool{
func isLanguageAllowed(language string) bool {
l := strings.ToLower(language)
if allowedLanguages[l] {
return true
}
return false
return allowedLanguages[l]
}
func handleI18nCurrentLanguage(w http.ResponseWriter, r *http.Request) {