Skip to content

Commit 2a0746d

Browse files
committed
make linter happy
1 parent 7fd66f4 commit 2a0746d

File tree

4 files changed

+8
-1
lines changed

4 files changed

+8
-1
lines changed

coderd/coderd.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -795,6 +795,7 @@ func (api *API) CreateInMemoryProvisionerDaemon(ctx context.Context, debounce ti
795795
}()
796796

797797
name := namesgenerator.GetRandomName(1)
798+
// nolint:gocritic // Inserting a provisioner daemon is a system function.
798799
daemon, err := api.Database.InsertProvisionerDaemon(dbauthz.AsSystemRestricted(ctx), database.InsertProvisionerDaemonParams{
799800
ID: uuid.New(),
800801
CreatedAt: database.Now(),

coderd/updatecheck/updatecheck.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ func (c *Checker) notifyIfNewer(prev, next Result) {
225225
}
226226

227227
func (c *Checker) lastUpdateCheck(ctx context.Context) (r Result, err error) {
228+
// nolint:gocritic // Getting the last update check is a system function.
228229
s, err := c.db.GetLastUpdateCheck(dbauthz.AsSystemRestricted(ctx))
229230
if err != nil {
230231
return r, err

coderd/users.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import (
3737
// @Router /users/first [get]
3838
func (api *API) firstUser(rw http.ResponseWriter, r *http.Request) {
3939
ctx := r.Context()
40+
// nolint:gocritic // Getting user count is a system function.
4041
userCount, err := api.Database.GetUserCount(dbauthz.AsSystemRestricted(ctx))
4142
if err != nil {
4243
httpapi.Write(ctx, rw, http.StatusInternalServerError, codersdk.Response{
@@ -70,14 +71,14 @@ func (api *API) firstUser(rw http.ResponseWriter, r *http.Request) {
7071
// @Success 201 {object} codersdk.CreateFirstUserResponse
7172
// @Router /users/first [post]
7273
func (api *API) postFirstUser(rw http.ResponseWriter, r *http.Request) {
73-
// TODO: Should this admin system context be in a middleware?
7474
ctx := r.Context()
7575
var createUser codersdk.CreateFirstUserRequest
7676
if !httpapi.Read(ctx, rw, r, &createUser) {
7777
return
7878
}
7979

8080
// This should only function for the first user.
81+
// nolint:gocritic // Getting user count is a system function.
8182
userCount, err := api.Database.GetUserCount(dbauthz.AsSystemRestricted(ctx))
8283
if err != nil {
8384
httpapi.Write(ctx, rw, http.StatusInternalServerError, codersdk.Response{

enterprise/replicasync/replicasync.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ func New(ctx context.Context, logger slog.Logger, db database.Store, pubsub data
6262
if err != nil {
6363
return nil, xerrors.Errorf("ping database: %w", err)
6464
}
65+
// nolint:gocritic // Inserting a replica is a system function.
6566
replica, err := db.InsertReplica(dbauthz.AsSystemRestricted(ctx), database.InsertReplicaParams{
6667
ID: options.ID,
6768
CreatedAt: database.Now(),
@@ -142,6 +143,7 @@ func (m *Manager) loop(ctx context.Context) {
142143
case <-ctx.Done():
143144
return
144145
case <-deleteTicker.C:
146+
// nolint:gocritic // Deleting a replica is a system function
145147
err := m.db.DeleteReplicasUpdatedBefore(dbauthz.AsSystemRestricted(ctx), m.updateInterval())
146148
if err != nil {
147149
m.logger.Warn(ctx, "delete old replicas", slog.Error(err))
@@ -219,6 +221,7 @@ func (m *Manager) syncReplicas(ctx context.Context) error {
219221
defer m.closeWait.Done()
220222
// Expect replicas to update once every three times the interval...
221223
// If they don't, assume death!
224+
// nolint:gocritic // Reading replicas is a system function
222225
replicas, err := m.db.GetReplicasUpdatedAfter(dbauthz.AsSystemRestricted(ctx), m.updateInterval())
223226
if err != nil {
224227
return xerrors.Errorf("get replicas: %w", err)
@@ -367,6 +370,7 @@ func (m *Manager) Close() error {
367370
defer m.mutex.Unlock()
368371
ctx, cancelFunc := context.WithTimeout(context.Background(), 5*time.Second)
369372
defer cancelFunc()
373+
// nolint:gocritic // Updating a replica is a sytsem function.
370374
_, err := m.db.UpdateReplica(dbauthz.AsSystemRestricted(ctx), database.UpdateReplicaParams{
371375
ID: m.self.ID,
372376
UpdatedAt: database.Now(),

0 commit comments

Comments
 (0)