Fix gometalinter warnings
This commit is contained in:
parent
aa3f3e2c43
commit
6257ff123f
6
app.go
6
app.go
|
@ -202,7 +202,7 @@ func getInput() (string, error) {
|
||||||
|
|
||||||
func promptAndGet(prompt string) (string, error) {
|
func promptAndGet(prompt string) (string, error) {
|
||||||
for {
|
for {
|
||||||
fmt.Printf(prompt)
|
fmt.Print(prompt)
|
||||||
input, err := getInput()
|
input, err := getInput()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Failed to get input, aborting: %s", err)
|
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) {
|
func promptAndGetPassword(prompt string) (string, error) {
|
||||||
for {
|
for {
|
||||||
fmt.Printf(prompt)
|
fmt.Print(prompt)
|
||||||
password, err := terminal.ReadPassword(int(os.Stdin.Fd()))
|
password, err := terminal.ReadPassword(int(os.Stdin.Fd()))
|
||||||
fmt.Printf("\n")
|
fmt.Print("\n")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Failed to get input, aborting: %s", err)
|
log.Printf("Failed to get input, aborting: %s", err)
|
||||||
return "", err
|
return "", err
|
||||||
|
|
|
@ -669,12 +669,7 @@ func (filter *filter) save() error {
|
||||||
filterFilePath := filter.Path()
|
filterFilePath := filter.Path()
|
||||||
log.Printf("Saving filter %d contents to: %s", filter.ID, filterFilePath)
|
log.Printf("Saving filter %d contents to: %s", filter.ID, filterFilePath)
|
||||||
|
|
||||||
err := safeWriteFile(filterFilePath, filter.Contents)
|
return safeWriteFile(filterFilePath, filter.Contents)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// loads filter contents from the file in dataDir
|
// loads filter contents from the file in dataDir
|
||||||
|
|
|
@ -31,12 +31,7 @@ func safeWriteFile(path string, data []byte) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
err = os.Rename(tmpPath, path)
|
return os.Rename(tmpPath, path)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------
|
// ----------------------------------
|
||||||
|
|
5
i18n.go
5
i18n.go
|
@ -24,10 +24,7 @@ var allowedLanguages = map[string]bool{
|
||||||
|
|
||||||
func isLanguageAllowed(language string) bool {
|
func isLanguageAllowed(language string) bool {
|
||||||
l := strings.ToLower(language)
|
l := strings.ToLower(language)
|
||||||
if allowedLanguages[l] {
|
return allowedLanguages[l]
|
||||||
return true
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func handleI18nCurrentLanguage(w http.ResponseWriter, r *http.Request) {
|
func handleI18nCurrentLanguage(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
Loading…
Reference in New Issue