Skip to content

Commit

Permalink
Fix lints
Browse files Browse the repository at this point in the history
  • Loading branch information
fmoor committed Jan 8, 2025
1 parent a878623 commit 0089e71
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
11 changes: 8 additions & 3 deletions internal/client/connutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ var (
`^(\w(?:-?\w)*)$`,
)
cloudInstanceNameRe = regexp.MustCompile(
`^([A-Za-z0-9_\-](?:-?[A-Za-z_0-9\-])*)/([A-Za-z0-9](?:-?[A-Za-z0-9])*)$`,
`^([A-Za-z0-9_\-](?:-?[A-Za-z_0-9\-])*)/` +
`([A-Za-z0-9](?:-?[A-Za-z0-9])*)$`,
)
domainLabelMaxLength = 63
crcTable *crc16.Table = crc16.MakeTable(crc16.CRC16_XMODEM)
Expand Down Expand Up @@ -1101,7 +1102,7 @@ func (r *configResolver) config(opts *Options) (*connConfig, error) {
return nil, err
} else if !ok {
clientSecurityVarName = "EDGEDB_CLIENT_SECURITY"
security, ok, err = getEnvVarSetting(clientSecurityVarName, "default",
security, _, err = getEnvVarSetting(clientSecurityVarName, "default",
"default", "insecure_dev_mode", "strict")
if err != nil {
return nil, err
Expand Down Expand Up @@ -1159,7 +1160,11 @@ func (r *configResolver) config(opts *Options) (*connConfig, error) {
}, nil
}

func getEnvVarSetting(name, defalt string, values ...string) (string, bool, error) {
func getEnvVarSetting(
name,
defalt string,
values ...string,
) (string, bool, error) {
value, ok := os.LookupEnv(name)
if !ok || value == "default" || value == "" {
return defalt, false, nil
Expand Down
4 changes: 2 additions & 2 deletions internal/client/scriptflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ func decodeHeaders1pX(
}

errors := make([]error, len(warnings))
for i, warning := range warnings {
errors[i] = warning.Err(query)
for i := range warnings {
errors[i] = warnings[i].Err(query)
}

err = warningHandler(errors)
Expand Down
1 change: 1 addition & 0 deletions internal/client/warning.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ type Warning struct {
Start *int `json:"start,omitempty"`
}

// Err makes the warning into an error.
func (w *Warning) Err(query string) error {
if w.Line == nil || w.Start == nil {
return errorFromCode(w.Code, w.Message)
Expand Down

0 comments on commit 0089e71

Please sign in to comment.