mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-07 09:05:55 +00:00
Merge pull request #1797 from molecula/staticcheck-issues-pt-2
[fb-964] fixes some more staticcheck errors
This commit is contained in:
commit
7788af166f
5 changed files with 9 additions and 14 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -292,8 +292,8 @@ func TestConfig_validateAddrsGRPC(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestConfig_validateAuth(t *testing.T) {
|
||||
errorMesgEmpty := "Empty string"
|
||||
errorMesgURL := "Invalid URL"
|
||||
errorMesgEmpty := "empty string"
|
||||
errorMesgURL := "invalid URL"
|
||||
validTestURL := "https://url.com/"
|
||||
validClientID := "clientid"
|
||||
validClientSecret := "clientSecret"
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue