diff --git a/agent/agent.go b/agent/agent.go index 8d3766dae89ad..bd3aec4408ff7 100644 --- a/agent/agent.go +++ b/agent/agent.go @@ -565,7 +565,6 @@ func (a *agent) reportMetadata(ctx context.Context, aAPI proto.DRPCAgentClient26 // channel to synchronize the results and avoid both messy // mutex logic and overloading the API. for _, md := range manifest.Metadata { - md := md // We send the result to the channel in the goroutine to avoid // sending the same result multiple times. So, we don't care about // the return values. diff --git a/agent/agentscripts/agentscripts.go b/agent/agentscripts/agentscripts.go index ac6e3a30f44a1..bde3305b15415 100644 --- a/agent/agentscripts/agentscripts.go +++ b/agent/agentscripts/agentscripts.go @@ -149,7 +149,6 @@ func (r *Runner) Init(scripts []codersdk.WorkspaceAgentScript, scriptCompleted S if script.Cron == "" { continue } - script := script _, err := r.cron.AddFunc(script.Cron, func() { err := r.trackRun(r.cronCtx, script, ExecuteCronScripts) if err != nil { @@ -224,7 +223,6 @@ func (r *Runner) Execute(ctx context.Context, option ExecuteOption) error { continue } - script := script eg.Go(func() error { err := r.trackRun(ctx, script, option) if err != nil { diff --git a/cli/organizationroles.go b/cli/organizationroles.go index 4d68ab02ae78d..3651baea88d2f 100644 --- a/cli/organizationroles.go +++ b/cli/organizationroles.go @@ -435,7 +435,6 @@ func applyOrgResourceActions(role *codersdk.Role, resource string, actions []str // Construct new site perms with only new perms for the resource keep := make([]codersdk.Permission, 0) for _, perm := range role.OrganizationPermissions { - perm := perm if string(perm.ResourceType) != resource { keep = append(keep, perm) } diff --git a/cli/organizationsettings.go b/cli/organizationsettings.go index 920ae41ebe1fc..391a4f72e27fd 100644 --- a/cli/organizationsettings.go +++ b/cli/organizationsettings.go @@ -116,7 +116,6 @@ func (r *RootCmd) setOrganizationSettings(orgContext *OrganizationContext, setti } for _, set := range settings { - set := set patch := set.Patch cmd.Children = append(cmd.Children, &serpent.Command{ Use: set.Name, @@ -192,7 +191,6 @@ func (r *RootCmd) printOrganizationSetting(orgContext *OrganizationContext, sett } for _, set := range settings { - set := set fetch := set.Fetch cmd.Children = append(cmd.Children, &serpent.Command{ Use: set.Name, diff --git a/cli/server.go b/cli/server.go index d739863b9fa6f..5074bffc3a342 100644 --- a/cli/server.go +++ b/cli/server.go @@ -1184,7 +1184,6 @@ func (r *RootCmd) Server(newAPI func(context.Context, *coderd.Options) (*coderd. var wg sync.WaitGroup for i, provisionerDaemon := range provisionerDaemons { id := i + 1 - provisionerDaemon := provisionerDaemon wg.Add(1) go func() { defer wg.Done() @@ -1662,7 +1661,6 @@ func configureServerTLS(ctx context.Context, logger slog.Logger, tlsMinVersion, // Expensively check which certificate matches the client hello. for _, cert := range certs { - cert := cert if err := hi.SupportsCertificate(&cert); err == nil { return &cert, nil } diff --git a/coderd/database/pubsub/pubsub_memory.go b/coderd/database/pubsub/pubsub_memory.go index c4766c3dfa3fb..59a5730ff9808 100644 --- a/coderd/database/pubsub/pubsub_memory.go +++ b/coderd/database/pubsub/pubsub_memory.go @@ -73,7 +73,6 @@ func (m *MemoryPubsub) Publish(event string, message []byte) error { var wg sync.WaitGroup for _, listener := range listeners { wg.Add(1) - listener := listener go func() { defer wg.Done() listener.send(context.Background(), message) diff --git a/coderd/externalauth/externalauth.go b/coderd/externalauth/externalauth.go index 600aacf62f7dd..9b8b87748e784 100644 --- a/coderd/externalauth/externalauth.go +++ b/coderd/externalauth/externalauth.go @@ -505,8 +505,6 @@ func ConvertConfig(instrument *promoauth.Factory, entries []codersdk.ExternalAut ids := map[string]struct{}{} configs := []*Config{} for _, entry := range entries { - entry := entry - // Applies defaults to the config entry. // This allows users to very simply state that they type is "GitHub", // apply their client secret and ID, and have the UI appear nicely. diff --git a/coderd/idpsync/group.go b/coderd/idpsync/group.go index b5d8003165665..0b21c5b9ac84c 100644 --- a/coderd/idpsync/group.go +++ b/coderd/idpsync/group.go @@ -99,7 +99,6 @@ func (s AGPLIDPSync) SyncGroups(ctx context.Context, db database.Store, user dat // membership via the groups the user is in. userOrgs := make(map[uuid.UUID][]database.GetGroupsRow) for _, g := range userGroups { - g := g userOrgs[g.Group.OrganizationID] = append(userOrgs[g.Group.OrganizationID], g) } @@ -337,8 +336,6 @@ func (s GroupSyncSettings) ParseClaims(orgID uuid.UUID, mergedClaims jwt.MapClai groups := make([]ExpectedGroup, 0) for _, group := range parsedGroups { - group := group - // Legacy group mappings happen before the regex filter. mappedGroupName, ok := s.LegacyNameMapping[group] if ok { @@ -355,7 +352,6 @@ func (s GroupSyncSettings) ParseClaims(orgID uuid.UUID, mergedClaims jwt.MapClai mappedGroupIDs, ok := s.Mapping[group] if ok { for _, gid := range mappedGroupIDs { - gid := gid groups = append(groups, ExpectedGroup{OrganizationID: orgID, GroupID: &gid}) } continue diff --git a/coderd/rbac/authz.go b/coderd/rbac/authz.go index a7f77d57ab253..f57ed2585c068 100644 --- a/coderd/rbac/authz.go +++ b/coderd/rbac/authz.go @@ -760,7 +760,6 @@ func rbacTraceAttributes(actor Subject, action policy.Action, objectType string, uniqueRoleNames := actor.SafeRoleNames() roleStrings := make([]string, 0, len(uniqueRoleNames)) for _, roleName := range uniqueRoleNames { - roleName := roleName roleStrings = append(roleStrings, roleName.String()) } return trace.WithAttributes( diff --git a/coderd/rbac/roles.go b/coderd/rbac/roles.go index 9075e7e711adc..ebc7ff8f12070 100644 --- a/coderd/rbac/roles.go +++ b/coderd/rbac/roles.go @@ -845,7 +845,6 @@ func Permissions(perms map[string][]policy.Action) []Permission { list := make([]Permission, 0, len(perms)) for k, actions := range perms { for _, act := range actions { - act := act list = append(list, Permission{ Negate: false, ResourceType: k, diff --git a/coderd/webpush/webpush.go b/coderd/webpush/webpush.go index eb35685402c21..0f54a269cad00 100644 --- a/coderd/webpush/webpush.go +++ b/coderd/webpush/webpush.go @@ -103,7 +103,6 @@ func (n *Webpusher) Dispatch(ctx context.Context, userID uuid.UUID, msg codersdk var mu sync.Mutex var eg errgroup.Group for _, subscription := range subscriptions { - subscription := subscription eg.Go(func() error { // TODO: Implement some retry logic here. For now, this is just a // best-effort attempt. diff --git a/enterprise/coderd/proxyhealth/proxyhealth.go b/enterprise/coderd/proxyhealth/proxyhealth.go index 7faac6a9e8147..ef721841362c8 100644 --- a/enterprise/coderd/proxyhealth/proxyhealth.go +++ b/enterprise/coderd/proxyhealth/proxyhealth.go @@ -240,7 +240,6 @@ func (p *ProxyHealth) runOnce(ctx context.Context, now time.Time) (map[uuid.UUID } // Each proxy needs to have a status set. Make a local copy for the // call to be run async. - proxy := proxy status := ProxyStatus{ Proxy: proxy, CheckedAt: now, diff --git a/enterprise/replicasync/replicasync.go b/enterprise/replicasync/replicasync.go index 0a60ccfd0a1fc..528540a262464 100644 --- a/enterprise/replicasync/replicasync.go +++ b/enterprise/replicasync/replicasync.go @@ -408,9 +408,6 @@ func (m *Manager) AllPrimary() []database.Replica { continue } - // When we assign the non-pointer to a - // variable it loses the reference. - replica := replica replicas = append(replicas, replica) } return replicas diff --git a/site/site.go b/site/site.go index 0a97b4a78d2cb..682d21c695a88 100644 --- a/site/site.go +++ b/site/site.go @@ -849,8 +849,6 @@ func verifyBinSha1IsCurrent(dest string, siteFS fs.FS, shaFiles map[string]strin // Verify the hash of each on-disk binary. for file, hash1 := range shaFiles { - file := file - hash1 := hash1 eg.Go(func() error { hash2, err := sha1HashFile(filepath.Join(dest, file)) if err != nil {