Fix minor linting issues

This commit is contained in:
Daniel Carrillo 2023-03-16 19:59:04 +01:00
parent 5c4ac4a3ee
commit eb200ddd81
Signed by: dcarrillo
GPG Key ID: E4CD5C09DAED6E16
2 changed files with 6 additions and 6 deletions

View File

@ -33,7 +33,7 @@ func main() {
fmt.Print(o) fmt.Print(o)
os.Exit(0) os.Exit(0)
} else if err != nil { } else if err != nil {
fmt.Print(err) fmt.Println(err)
os.Exit(1) os.Exit(1)
} }

View File

@ -100,24 +100,24 @@ func Setup(args []string) (output string, err error) {
} }
if App.TrustedPortHeader != "" && App.TrustedHeader == "" { if App.TrustedPortHeader != "" && App.TrustedHeader == "" {
return "", fmt.Errorf("truster-header is mandatory when truster-port-header is set\n") return "", fmt.Errorf("truster-header is mandatory when truster-port-header is set")
} }
if App.GeodbPath.City == "" || App.GeodbPath.ASN == "" { if App.GeodbPath.City == "" || App.GeodbPath.ASN == "" {
return "", fmt.Errorf("geoip2-city and geoip2-asn parameters are mandatory\n") return "", fmt.Errorf("geoip2-city and geoip2-asn parameters are mandatory")
} }
if (App.TLSAddress != "") && (App.TLSCrtPath == "" || App.TLSKeyPath == "") { if (App.TLSAddress != "") && (App.TLSCrtPath == "" || App.TLSKeyPath == "") {
return "", fmt.Errorf("In order to use TLS -tls-crt and -tls-key flags are mandatory\n") return "", fmt.Errorf("in order to use TLS, the -tls-crt and -tls-key flags are mandatory")
} }
if App.TemplatePath != "" { if App.TemplatePath != "" {
info, err := os.Stat(App.TemplatePath) info, err := os.Stat(App.TemplatePath)
if os.IsNotExist(err) { if os.IsNotExist(err) {
return "", fmt.Errorf("%s no such file or directory\n", App.TemplatePath) return "", fmt.Errorf("%s no such file or directory", App.TemplatePath)
} }
if info.IsDir() { if info.IsDir() {
return "", fmt.Errorf("%s must be a file\n", App.TemplatePath) return "", fmt.Errorf("%s must be a file", App.TemplatePath)
} }
} }