Skip to content

Commit 117f838

Browse files
committed
Linting
1 parent b76f373 commit 117f838

File tree

5 files changed

+7
-20
lines changed

5 files changed

+7
-20
lines changed

coderd/coderd_test.go

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,8 @@ package coderd_test
22

33
import (
44
"context"
5-
"fmt"
6-
"net/http"
75
"testing"
86

9-
"github.com/coder/coder/coderd"
10-
"github.com/go-chi/chi/v5"
11-
127
"go.uber.org/goleak"
138

149
"github.com/stretchr/testify/require"
@@ -29,12 +24,3 @@ func TestBuildInfo(t *testing.T) {
2924
require.Equal(t, buildinfo.ExternalURL(), buildInfo.ExternalURL, "external URL")
3025
require.Equal(t, buildinfo.Version(), buildInfo.Version, "version")
3126
}
32-
33-
func TestWalk(t *testing.T) {
34-
r, _ := coderd.New(&coderd.Options{})
35-
chiRouter := r.(chi.Router)
36-
chi.Walk(chiRouter, func(method string, route string, handler http.Handler, middlewares ...func(http.Handler) http.Handler) error {
37-
fmt.Println(method, route)
38-
return nil
39-
})
40-
}

coderd/database/databasefake/databasefake.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,14 +245,15 @@ func (q *fakeQuerier) GetUsers(_ context.Context, params database.GetUsersParams
245245
return tmp, nil
246246
}
247247

248-
func (q *fakeQuerier) GetAllUserRoles(ctx context.Context, userID uuid.UUID) (database.GetAllUserRolesRow, error) {
248+
func (q *fakeQuerier) GetAllUserRoles(_ context.Context, userID uuid.UUID) (database.GetAllUserRolesRow, error) {
249249
q.mutex.RLock()
250250
defer q.mutex.RUnlock()
251251

252252
var user *database.User
253253
roles := make([]string, 0)
254254
for _, u := range q.users {
255255
if u.ID == userID {
256+
u := u
256257
roles = append(roles, u.RBACRoles...)
257258
user = &u
258259
break

coderd/httpmw/authorize.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package httpmw
22

33
import (
44
"context"
5-
"fmt"
65
"net/http"
76

87
"golang.org/x/xerrors"
@@ -111,7 +110,7 @@ func ExtractUserRoles(db database.Store) func(http.Handler) http.Handler {
111110
role, err := db.GetAllUserRoles(r.Context(), apiKey.UserID)
112111
if err != nil {
113112
httpapi.Write(rw, http.StatusUnauthorized, httpapi.Response{
114-
Message: fmt.Sprintf("roles not found", AuthCookie),
113+
Message: "roles not found",
115114
})
116115
return
117116
}

coderd/roles.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ import (
1010
)
1111

1212
// assignableSiteRoles returns all site wide roles that can be assigned.
13-
func (api *api) assignableSiteRoles(rw http.ResponseWriter, r *http.Request) {
13+
func (*api) assignableSiteRoles(rw http.ResponseWriter, _ *http.Request) {
1414
// TODO: @emyrk in the future, allow granular subsets of roles to be returned based on the
1515
// role of the user.
1616
roles := rbac.SiteRoles()
1717
httpapi.Write(rw, http.StatusOK, roles)
1818
}
1919

2020
// assignableSiteRoles returns all site wide roles that can be assigned.
21-
func (api *api) assignableOrgRoles(rw http.ResponseWriter, r *http.Request) {
21+
func (*api) assignableOrgRoles(rw http.ResponseWriter, r *http.Request) {
2222
// TODO: @emyrk in the future, allow granular subsets of roles to be returned based on the
2323
// role of the user.
2424
organization := httpmw.OrganizationParam(r)

coderd/roles_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@ import (
55
"net/http"
66
"testing"
77

8+
"github.com/stretchr/testify/require"
9+
810
"github.com/coder/coder/coderd/coderdtest"
911
"github.com/coder/coder/coderd/rbac"
1012
"github.com/coder/coder/codersdk"
11-
"github.com/stretchr/testify/require"
1213
)
1314

1415
func TestListRoles(t *testing.T) {

0 commit comments

Comments
 (0)