Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

task: use the recommended slice initialization #2798

Merged
merged 1 commit into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions internal/cli/atlas/datalakepipelines/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,13 @@ func (opts *CreateOpts) newCreateRequest() (*atlasv2.DataLakeIngestionPipeline,
},
}

partitionFields := []atlasv2.DataLakePipelinesPartitionField{}
partitionFields := make([]atlasv2.DataLakePipelinesPartitionField, len(opts.sinkPartitionField))
for i, fieldName := range opts.sinkPartitionField {
partitionFields = append(partitionFields, *atlasv2.NewDataLakePipelinesPartitionField(fieldName, i))
partitionFields[i] = *atlasv2.NewDataLakePipelinesPartitionField(fieldName, i)
}
pipeline.Sink.SetPartitionFields(partitionFields)

transformations := []atlasv2.FieldTransformation{}
var transformations []atlasv2.FieldTransformation
for _, entry := range opts.transform {
entries := strings.Split(entry, ":")
transformType := entries[0]
Expand Down
6 changes: 3 additions & 3 deletions internal/cli/atlas/datalakepipelines/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,13 @@ func (opts *UpdateOpts) newUpdateRequest() (*atlasv2.DataLakeIngestionPipeline,
},
}

partitionFields := []atlasv2.DataLakePipelinesPartitionField{}
partitionFields := make([]atlasv2.DataLakePipelinesPartitionField, len(opts.sinkPartitionField))
for i, fieldName := range opts.sinkPartitionField {
partitionFields = append(partitionFields, *atlasv2.NewDataLakePipelinesPartitionField(fieldName, i))
partitionFields[i] = *atlasv2.NewDataLakePipelinesPartitionField(fieldName, i)
}
pipeline.Sink.SetPartitionFields(partitionFields)

transformations := []atlasv2.FieldTransformation{}
var transformations []atlasv2.FieldTransformation
for _, entry := range opts.transform {
entries := strings.Split(entry, ":")
transformType := entries[0]
Expand Down
2 changes: 1 addition & 1 deletion internal/cli/atlas/security/ldap/save.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func (opts *SaveOpts) validate() error {
}

func (opts *SaveOpts) newLDAPConfiguration() *atlasv2.UserSecurity {
userToDNMapping := []atlasv2.UserToDNMapping{}
var userToDNMapping []atlasv2.UserToDNMapping
if opts.mappingMatch != "" {
mapping := atlasv2.UserToDNMapping{Match: opts.mappingMatch}
if opts.mappingLdapQuery != "" {
Expand Down
2 changes: 1 addition & 1 deletion internal/cli/atlas/serverless/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func (opts *CreateOpts) newServerlessCreateRequestParams() *atlasv2.ServerlessIn
}

if len(opts.tag) > 0 {
tags := []atlasv2.ResourceTag{}
var tags []atlasv2.ResourceTag
for k, v := range opts.tag {
if k != "" && v != "" {
tags = append(tags, atlasv2.ResourceTag{Key: k, Value: v})
Expand Down
2 changes: 1 addition & 1 deletion internal/cli/atlas/serverless/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func (opts *UpdateOpts) newServerlessUpdateRequestParams() *atlasv2.ServerlessIn
}

if len(opts.tag) > 0 {
tags := []atlasv2.ResourceTag{}
var tags []atlasv2.ResourceTag
for k, v := range opts.tag {
if k != "" && v != "" {
tags = append(tags, atlasv2.ResourceTag{Key: k, Value: v})
Expand Down
2 changes: 1 addition & 1 deletion internal/cli/atlas/setup/cluster_setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func (opts *Opts) newCluster() *atlasv2.AdvancedClusterDescription {
}

if len(opts.Tag) > 0 {
tags := []atlasv2.ResourceTag{}
var tags []atlasv2.ResourceTag
for k, v := range opts.Tag {
if k != "" && v != "" {
tags = append(tags, atlasv2.ResourceTag{Key: k, Value: v})
Expand Down
2 changes: 1 addition & 1 deletion internal/kubernetes/operator/project/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,7 @@ func buildAlertConfigurations(acProvider store.AlertConfigurationLister, project
return akoNotifications, akoSecrets
}

secretResults := []*corev1.Secret{}
var secretResults []*corev1.Secret
results := make([]akov2.AlertConfiguration, 0, len(data.GetResults()))
for _, alertConfig := range data.GetResults() {
notifications, notificationSecrets := convertNotifications(alertConfig.GetNotifications())
Expand Down
3 changes: 1 addition & 2 deletions internal/podman/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -482,8 +482,7 @@ func (o *client) Version(ctx context.Context) (version *Version, err error) {

func (o *client) Logs(ctx context.Context) (map[string]interface{}, []error) {
l := map[string]interface{}{}
errs := []error{}

var errs []error
output, err := o.runPodman(ctx, "ps", "--all", "--format", "json", "--filter", "name=mongo")
if err != nil {
errs = append(errs, err)
Expand Down
Loading