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: remove unnecessary parenthesis #2784

Merged
merged 3 commits into from Mar 20, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/cli/atlas/networking/peering/create/azure.go
Expand Up @@ -103,7 +103,7 @@ func (opts *AzureOpts) newContainer() *atlasv2.CloudProviderContainer {
}

func (opts *AzureOpts) newPeer(containerID string) *atlasv2.BaseNetworkPeeringConnectionSettings {
return opts.newAzurePeer((containerID))
return opts.newAzurePeer(containerID)
}

func (opts *AzureOpts) newAzurePeer(containerID string) *atlasv2.BaseNetworkPeeringConnectionSettings {
Expand Down
16 changes: 8 additions & 8 deletions internal/kubernetes/operator/secrets/secrets.go
Expand Up @@ -36,7 +36,7 @@ const (
type AtlasSecretBuilder func() (*corev1.Secret, map[string]string)

func NewAtlasSecretBuilder(name, namespace string, dictionary map[string]string) AtlasSecretBuilder {
return AtlasSecretBuilder(func() (*corev1.Secret, map[string]string) {
return func() (*corev1.Secret, map[string]string) {
secret := &corev1.Secret{
TypeMeta: v1.TypeMeta{
Kind: "Secret",
Expand All @@ -51,36 +51,36 @@ func NewAtlasSecretBuilder(name, namespace string, dictionary map[string]string)
},
}
return secret, dictionary
})
}
}

func (a AtlasSecretBuilder) WithData(data map[string][]byte) AtlasSecretBuilder {
return AtlasSecretBuilder(func() (*corev1.Secret, map[string]string) {
return func() (*corev1.Secret, map[string]string) {
s, d := a()
s.Data = data
return s, d
})
}
}

func (a AtlasSecretBuilder) WithProjectLabels(id, name string) AtlasSecretBuilder {
return AtlasSecretBuilder(func() (*corev1.Secret, map[string]string) {
return func() (*corev1.Secret, map[string]string) {
s, d := a()
s.Labels[ProjectIDLabelKey] = resources.NormalizeAtlasName(id, d)
s.Labels[ProjectNameLabelKey] = resources.NormalizeAtlasName(name, d)
return s, d
})
}
}

func (a AtlasSecretBuilder) WithNotifierLabels(id *string, typeName string) AtlasSecretBuilder {
return AtlasSecretBuilder(func() (*corev1.Secret, map[string]string) {
return func() (*corev1.Secret, map[string]string) {
s, d := a()
if id == nil {
return s, d
}
s.Labels[NotifierIDLabelKey] = resources.NormalizeAtlasName(*id, d)
s.Labels[NotifierNameLabelKey] = typeName // don't normalize type name, as it is already a short form
return s, d
})
}
}

func (a AtlasSecretBuilder) Build() *corev1.Secret {
Expand Down
4 changes: 2 additions & 2 deletions tools/templates-checker/templateparsing/templateparsing.go
Expand Up @@ -340,9 +340,9 @@ func pipelineToIdentifiers(pipeline *parse.PipeNode) ([]string, error) {
}

switch arg := arg.(type) {
case (*parse.DotNode):
case *parse.DotNode:
return make([]string, 0), nil
case (*parse.FieldNode):
case *parse.FieldNode:
return arg.Ident, nil
default:
return nil, errors.New("unsupported node type")
Expand Down
10 changes: 5 additions & 5 deletions tools/templates-checker/templateparsing/validation.go
Expand Up @@ -65,15 +65,15 @@ func (c *TemplateCallTree) Validate(pkg *packages.Package, typeInfo types.Type)

func (c *TemplateCallTree) validateInner(pkg *packages.Package, result *ValidationResult, breadCrumb string, typeInfo types.Type) error {
switch typeInfo := typeInfo.(type) {
case (*types.Basic):
case *types.Basic:
return c.validateBasic(result, breadCrumb)
case (*types.Map):
case *types.Map:
return c.validateMap(pkg, result, breadCrumb, typeInfo)
case (*types.Named):
case *types.Named:
return c.validateStruct(pkg, result, breadCrumb, typeInfo)
case (*types.Pointer):
case *types.Pointer:
return c.validateInner(pkg, result, breadCrumb, typeInfo.Elem())
case (*types.Slice):
case *types.Slice:
return c.validateSlice(pkg, result, breadCrumb, typeInfo)

default:
Expand Down