mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2024-11-22 13:05:36 +03:00
Fix gometalinter warnings
This commit is contained in:
parent
aa3f3e2c43
commit
6257ff123f
4 changed files with 6 additions and 19 deletions
6
app.go
6
app.go
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
||||
// ----------------------------------
|
||||
|
|
5
i18n.go
5
i18n.go
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue