Skip to content

Commit daccf42

Browse files
committed
fixup comment
1 parent a13d333 commit daccf42

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

cli/server.go

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -944,12 +944,18 @@ func (r *RootCmd) Server(newAPI func(context.Context, *coderd.Options) (*coderd.
944944
var provisionerdWaitGroup sync.WaitGroup
945945
defer provisionerdWaitGroup.Wait()
946946
provisionerdMetrics := provisionerd.NewMetrics(options.PrometheusRegistry)
947-
// Create a list of daemon types. The length is the total number of built in provisioners, and
948-
// the slice value is the type for each.
949-
daemons := append(
950-
fill(make([]codersdk.ProvisionerType, vals.Provisioner.DaemonsTerraform.Value()), codersdk.ProvisionerTypeTerraform),
951-
fill(make([]codersdk.ProvisionerType, vals.Provisioner.DaemonsEcho.Value()), codersdk.ProvisionerTypeEcho)...,
952-
)
947+
948+
// Create a list of daemon types. The length is the total number of built-in provisioners, and
949+
// the slice value is the type for each. This is just an easy way to pass the types
950+
// to a single loop. Ensuring each provisioner has a unique suffix with their index.
951+
daemons := make([]codersdk.ProvisionerType, 0)
952+
for i := int64(0); i < vals.Provisioner.DaemonsTerraform.Value(); i++ {
953+
daemons = append(daemons, codersdk.ProvisionerTypeTerraform)
954+
}
955+
for i := int64(0); i < vals.Provisioner.DaemonsTerraform.Value(); i++ {
956+
daemons = append(daemons, codersdk.ProvisionerTypeEcho)
957+
}
958+
953959
for i, provisionerType := range daemons {
954960
suffix := fmt.Sprintf("%d", i)
955961
// The suffix is added to the hostname, so we may need to trim to fit into
@@ -2584,11 +2590,3 @@ func getPostgresDB(ctx context.Context, logger slog.Logger, postgresURL string,
25842590

25852591
return sqlDB, dbURL, nil
25862592
}
2587-
2588-
// fill will fill the src with the value 'v'
2589-
func fill[T any](src []T, v T) []T {
2590-
for i := range src {
2591-
src[i] = v
2592-
}
2593-
return src
2594-
}

0 commit comments

Comments
 (0)