Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit09cc906

Browse files
authored
chore: remove unnecessary redeclarations in for loops (part 2) (#18593)
1 parente03d132 commit09cc906

File tree

14 files changed

+0
-24
lines changed

14 files changed

+0
-24
lines changed

‎agent/agent.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,6 @@ func (a *agent) reportMetadata(ctx context.Context, aAPI proto.DRPCAgentClient26
565565
// channel to synchronize the results and avoid both messy
566566
// mutex logic and overloading the API.
567567
for_,md:=rangemanifest.Metadata {
568-
md:=md
569568
// We send the result to the channel in the goroutine to avoid
570569
// sending the same result multiple times. So, we don't care about
571570
// the return values.

‎agent/agentscripts/agentscripts.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,6 @@ func (r *Runner) Init(scripts []codersdk.WorkspaceAgentScript, scriptCompleted S
149149
ifscript.Cron=="" {
150150
continue
151151
}
152-
script:=script
153152
_,err:=r.cron.AddFunc(script.Cron,func() {
154153
err:=r.trackRun(r.cronCtx,script,ExecuteCronScripts)
155154
iferr!=nil {
@@ -224,7 +223,6 @@ func (r *Runner) Execute(ctx context.Context, option ExecuteOption) error {
224223
continue
225224
}
226225

227-
script:=script
228226
eg.Go(func()error {
229227
err:=r.trackRun(ctx,script,option)
230228
iferr!=nil {

‎cli/organizationroles.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,6 @@ func applyOrgResourceActions(role *codersdk.Role, resource string, actions []str
435435
// Construct new site perms with only new perms for the resource
436436
keep:=make([]codersdk.Permission,0)
437437
for_,perm:=rangerole.OrganizationPermissions {
438-
perm:=perm
439438
ifstring(perm.ResourceType)!=resource {
440439
keep=append(keep,perm)
441440
}

‎cli/organizationsettings.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ func (r *RootCmd) setOrganizationSettings(orgContext *OrganizationContext, setti
116116
}
117117

118118
for_,set:=rangesettings {
119-
set:=set
120119
patch:=set.Patch
121120
cmd.Children=append(cmd.Children,&serpent.Command{
122121
Use:set.Name,
@@ -192,7 +191,6 @@ func (r *RootCmd) printOrganizationSetting(orgContext *OrganizationContext, sett
192191
}
193192

194193
for_,set:=rangesettings {
195-
set:=set
196194
fetch:=set.Fetch
197195
cmd.Children=append(cmd.Children,&serpent.Command{
198196
Use:set.Name,

‎cli/server.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1184,7 +1184,6 @@ func (r *RootCmd) Server(newAPI func(context.Context, *coderd.Options) (*coderd.
11841184
varwg sync.WaitGroup
11851185
fori,provisionerDaemon:=rangeprovisionerDaemons {
11861186
id:=i+1
1187-
provisionerDaemon:=provisionerDaemon
11881187
wg.Add(1)
11891188
gofunc() {
11901189
deferwg.Done()
@@ -1662,7 +1661,6 @@ func configureServerTLS(ctx context.Context, logger slog.Logger, tlsMinVersion,
16621661

16631662
// Expensively check which certificate matches the client hello.
16641663
for_,cert:=rangecerts {
1665-
cert:=cert
16661664
iferr:=hi.SupportsCertificate(&cert);err==nil {
16671665
return&cert,nil
16681666
}

‎coderd/database/pubsub/pubsub_memory.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ func (m *MemoryPubsub) Publish(event string, message []byte) error {
7373
varwg sync.WaitGroup
7474
for_,listener:=rangelisteners {
7575
wg.Add(1)
76-
listener:=listener
7776
gofunc() {
7877
deferwg.Done()
7978
listener.send(context.Background(),message)

‎coderd/externalauth/externalauth.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -505,8 +505,6 @@ func ConvertConfig(instrument *promoauth.Factory, entries []codersdk.ExternalAut
505505
ids:=map[string]struct{}{}
506506
configs:= []*Config{}
507507
for_,entry:=rangeentries {
508-
entry:=entry
509-
510508
// Applies defaults to the config entry.
511509
// This allows users to very simply state that they type is "GitHub",
512510
// apply their client secret and ID, and have the UI appear nicely.

‎coderd/idpsync/group.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ func (s AGPLIDPSync) SyncGroups(ctx context.Context, db database.Store, user dat
9999
// membership via the groups the user is in.
100100
userOrgs:=make(map[uuid.UUID][]database.GetGroupsRow)
101101
for_,g:=rangeuserGroups {
102-
g:=g
103102
userOrgs[g.Group.OrganizationID]=append(userOrgs[g.Group.OrganizationID],g)
104103
}
105104

@@ -337,8 +336,6 @@ func (s GroupSyncSettings) ParseClaims(orgID uuid.UUID, mergedClaims jwt.MapClai
337336

338337
groups:=make([]ExpectedGroup,0)
339338
for_,group:=rangeparsedGroups {
340-
group:=group
341-
342339
// Legacy group mappings happen before the regex filter.
343340
mappedGroupName,ok:=s.LegacyNameMapping[group]
344341
ifok {
@@ -355,7 +352,6 @@ func (s GroupSyncSettings) ParseClaims(orgID uuid.UUID, mergedClaims jwt.MapClai
355352
mappedGroupIDs,ok:=s.Mapping[group]
356353
ifok {
357354
for_,gid:=rangemappedGroupIDs {
358-
gid:=gid
359355
groups=append(groups,ExpectedGroup{OrganizationID:orgID,GroupID:&gid})
360356
}
361357
continue

‎coderd/rbac/authz.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -760,7 +760,6 @@ func rbacTraceAttributes(actor Subject, action policy.Action, objectType string,
760760
uniqueRoleNames:=actor.SafeRoleNames()
761761
roleStrings:=make([]string,0,len(uniqueRoleNames))
762762
for_,roleName:=rangeuniqueRoleNames {
763-
roleName:=roleName
764763
roleStrings=append(roleStrings,roleName.String())
765764
}
766765
returntrace.WithAttributes(

‎coderd/rbac/roles.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -845,7 +845,6 @@ func Permissions(perms map[string][]policy.Action) []Permission {
845845
list:=make([]Permission,0,len(perms))
846846
fork,actions:=rangeperms {
847847
for_,act:=rangeactions {
848-
act:=act
849848
list=append(list,Permission{
850849
Negate:false,
851850
ResourceType:k,

‎coderd/webpush/webpush.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ func (n *Webpusher) Dispatch(ctx context.Context, userID uuid.UUID, msg codersdk
103103
varmu sync.Mutex
104104
vareg errgroup.Group
105105
for_,subscription:=rangesubscriptions {
106-
subscription:=subscription
107106
eg.Go(func()error {
108107
// TODO: Implement some retry logic here. For now, this is just a
109108
// best-effort attempt.

‎enterprise/coderd/proxyhealth/proxyhealth.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,6 @@ func (p *ProxyHealth) runOnce(ctx context.Context, now time.Time) (map[uuid.UUID
240240
}
241241
// Each proxy needs to have a status set. Make a local copy for the
242242
// call to be run async.
243-
proxy:=proxy
244243
status:=ProxyStatus{
245244
Proxy:proxy,
246245
CheckedAt:now,

‎enterprise/replicasync/replicasync.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -408,9 +408,6 @@ func (m *Manager) AllPrimary() []database.Replica {
408408
continue
409409
}
410410

411-
// When we assign the non-pointer to a
412-
// variable it loses the reference.
413-
replica:=replica
414411
replicas=append(replicas,replica)
415412
}
416413
returnreplicas

‎site/site.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -849,8 +849,6 @@ func verifyBinSha1IsCurrent(dest string, siteFS fs.FS, shaFiles map[string]strin
849849

850850
// Verify the hash of each on-disk binary.
851851
forfile,hash1:=rangeshaFiles {
852-
file:=file
853-
hash1:=hash1
854852
eg.Go(func()error {
855853
hash2,err:=sha1HashFile(filepath.Join(dest,file))
856854
iferr!=nil {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp