Skip to content

Commit 7f93228

Browse files
committed
more fixes
1 parent 0b3571a commit 7f93228

File tree

5 files changed

+9
-11
lines changed

5 files changed

+9
-11
lines changed

coderd/externalauth/externalauth.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,7 @@ func copyDefaultSettings(config *codersdk.ExternalAuthConfig, defaults codersdk.
664664
if config.Regex == "" {
665665
config.Regex = defaults.Regex
666666
}
667-
if config.Scopes == nil || len(config.Scopes) == 0 {
667+
if len(config.Scopes) == 0 {
668668
config.Scopes = defaults.Scopes
669669
}
670670
if config.DeviceCodeURL == "" {
@@ -676,7 +676,7 @@ func copyDefaultSettings(config *codersdk.ExternalAuthConfig, defaults codersdk.
676676
if config.DisplayIcon == "" {
677677
config.DisplayIcon = defaults.DisplayIcon
678678
}
679-
if config.ExtraTokenKeys == nil || len(config.ExtraTokenKeys) == 0 {
679+
if len(config.ExtraTokenKeys) == 0 {
680680
config.ExtraTokenKeys = defaults.ExtraTokenKeys
681681
}
682682

coderd/healthcheck/workspaceproxy_test.go

+2-4
Original file line numberDiff line numberDiff line change
@@ -195,10 +195,8 @@ func TestWorkspaceProxies(t *testing.T) {
195195
assert.Equal(t, tt.expectedSeverity, rpt.Severity)
196196
if tt.expectedError != "" && assert.NotNil(t, rpt.Error) {
197197
assert.Contains(t, *rpt.Error, tt.expectedError)
198-
} else {
199-
if !assert.Nil(t, rpt.Error) {
200-
t.Logf("error: %v", *rpt.Error)
201-
}
198+
} else if !assert.Nil(t, rpt.Error) {
199+
t.Logf("error: %v", *rpt.Error)
202200
}
203201
if tt.expectedWarningCode != "" && assert.NotEmpty(t, rpt.Warnings) {
204202
var found bool

coderd/schedule/template.go

+2
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ func VerifyTemplateAutostopRequirement(days uint8, weeks int64) error {
8989
if days&0b10000000 != 0 {
9090
return xerrors.New("invalid autostop requirement days, last bit is set")
9191
}
92+
//nolint:staticcheck
9293
if days > 0b11111111 {
9394
return xerrors.New("invalid autostop requirement days, too large")
9495
}
@@ -107,6 +108,7 @@ func VerifyTemplateAutostartRequirement(days uint8) error {
107108
if days&0b10000000 != 0 {
108109
return xerrors.New("invalid autostart requirement days, last bit is set")
109110
}
111+
//nolint:staticcheck
110112
if days > 0b11111111 {
111113
return xerrors.New("invalid autostart requirement days, too large")
112114
}

coderd/templateversions.go

+2-4
Original file line numberDiff line numberDiff line change
@@ -1280,10 +1280,8 @@ func (api *API) setArchiveTemplateVersion(archive bool) func(rw http.ResponseWri
12801280

12811281
if archiveError != nil {
12821282
err = archiveError
1283-
} else {
1284-
if len(archived) == 0 {
1285-
err = xerrors.New("Unable to archive specified version, the version is likely in use by a workspace or currently set to the active version")
1286-
}
1283+
} else if len(archived) == 0 {
1284+
err = xerrors.New("Unable to archive specified version, the version is likely in use by a workspace or currently set to the active version")
12871285
}
12881286
} else {
12891287
err = api.Database.UnarchiveTemplateVersion(ctx, database.UnarchiveTemplateVersionParams{

coderd/userauth_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1452,7 +1452,7 @@ func TestUserOIDC(t *testing.T) {
14521452
oidctest.WithStaticUserInfo(tc.UserInfoClaims),
14531453
}
14541454

1455-
if tc.AccessTokenClaims != nil && len(tc.AccessTokenClaims) > 0 {
1455+
if len(tc.AccessTokenClaims) > 0 {
14561456
opts = append(opts, oidctest.WithAccessTokenJWTHook(func(email string, exp time.Time) jwt.MapClaims {
14571457
return tc.AccessTokenClaims
14581458
}))

0 commit comments

Comments
 (0)