fixes some more staticcheck errors

This commit is contained in:
reesporte 2021-12-03 16:50:02 -06:00
parent d47cf8d3de
commit b046ad5e8f
4 changed files with 7 additions and 12 deletions

View file

@ -243,9 +243,8 @@ func copyFile(src, dest string) error {
}
func Migrate(dataDir, backupPath string) error {
if strings.HasSuffix(dataDir, "/") {
dataDir = dataDir[:len(dataDir)-1]
}
dataDir = strings.TrimSuffix(dataDir, "/")
err := os.MkdirAll(backupPath, 0777)
if err != nil {
return err

View file

@ -625,14 +625,14 @@ func (c *Config) ValidateAuth() ([]error, error) {
errors := make([]error, 0)
for name, value := range authConfig {
if value == "" {
errors = append(errors, fmt.Errorf("Empty string for auth config %s", name))
errors = append(errors, fmt.Errorf("empty string for auth config %s", name))
continue
}
if strings.Contains(name, "URL") {
_, err := url.ParseRequestURI(value)
if err != nil {
errors = append(errors, fmt.Errorf("Invalid URL for auth config %s: %s", name, err))
errors = append(errors, fmt.Errorf("invalid URL for auth config %s: %s", name, err))
continue
}
}

View file

@ -31,16 +31,12 @@ type TestQueryResultWriter struct {
}
func (t *TestQueryResultWriter) WriteHeader(headers ...pg.ColumnInfo) error {
for _, header := range headers {
t.Header = append(t.Header, header)
}
t.Header = append(t.Header, headers...)
return nil
}
func (t *TestQueryResultWriter) WriteRowText(rowTexts ...string) error {
for _, rowText := range rowTexts {
t.RowText = append(t.RowText, rowText)
}
t.RowText = append(t.RowText, rowTexts...)
return nil
}

View file

@ -234,7 +234,7 @@ func (m *Command) Start() (err error) {
return errors.Wrap(err, "setting resource limits")
}
if m.Config.Auth.Enable == true {
if m.Config.Auth.Enable {
m.Config.MustValidateAuth()
}