Skip to content

Commit

Permalink
Merge branch 'master' into CLOUDP-234797
Browse files Browse the repository at this point in the history
  • Loading branch information
blva committed Mar 20, 2024
2 parents 37048d9 + f9886af commit 8c218d9
Show file tree
Hide file tree
Showing 12 changed files with 32 additions and 35 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/code-health.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: golangci-lint
uses: golangci/[email protected]
with:
version: v1.56.1
version: v1.56.2
unit-tests:
env:
COVERAGE: coverage.out
Expand Down
1 change: 0 additions & 1 deletion .tool-versions

This file was deleted.

3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# A Self-Documenting Makefile: http://marmelab.com/blog/2016/02/29/auto-documented-makefile.html

GOLANGCI_VERSION=v1.56.1
GOLANGCI_VERSION=v1.56.2
COVERAGE=coverage.out

MCLI_GIT_SHA?=$(shell git rev-parse HEAD)
Expand Down Expand Up @@ -28,6 +28,7 @@ export PATH := $(shell go env GOPATH)/bin:$(PATH)
export PATH := ./bin:$(PATH)
export TERM := linux-m
export GO111MODULE := on
export GOTOOLCHAIN := local
export ATLAS_E2E_BINARY

.PHONY: pre-commit
Expand Down
2 changes: 1 addition & 1 deletion docs/command/atlas-clusters-create.txt
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ Options
- false
- Major MongoDB version of the cluster.

Mutually exclusive with --file.
Mutually exclusive with --file. This value defaults to "7.0".
* - -m, --members
- int
- false
Expand Down
6 changes: 4 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ module github.com/mongodb/mongodb-atlas-cli/atlascli

go 1.22

toolchain go1.22.1

require (
cloud.google.com/go/kms v1.15.8
github.com/AlecAivazis/survey/v2 v2.3.7
Expand All @@ -18,7 +20,7 @@ require (
github.com/briandowns/spinner v1.23.0
github.com/creack/pty v1.1.21
github.com/denisbrodbeck/machineid v1.0.1
github.com/evergreen-ci/shrub v0.0.0-20231121224157-600e066f9de6
github.com/evergreen-ci/shrub v0.0.0-20240215220116-3f233ddeff2a
github.com/gemalto/kmip-go v0.0.10
github.com/go-test/deep v1.1.0
github.com/golang-jwt/jwt/v4 v4.5.0
Expand All @@ -44,7 +46,7 @@ require (
go.mongodb.org/atlas-sdk/v20231115008 v20231115008.0.0
go.mongodb.org/mongo-driver v1.14.0
golang.org/x/crypto v0.21.0
golang.org/x/exp v0.0.0-20240103183307-be819d1f06fc
golang.org/x/exp v0.0.0-20240318143956-a85f2c67cd81
golang.org/x/mod v0.16.0
golang.org/x/tools v0.19.0
google.golang.org/api v0.170.0
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ github.com/evanphx/json-patch v5.6.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLi
github.com/evanphx/json-patch/v5 v5.6.0/go.mod h1:G79N1coSVB93tBe7j6PhzjmR3/2VvlbKOFpnXhI9Bw4=
github.com/evanphx/json-patch/v5 v5.8.0 h1:lRj6N9Nci7MvzrXuX6HFzU8XjmhPiXPlsKEy1u0KQro=
github.com/evanphx/json-patch/v5 v5.8.0/go.mod h1:VNkHZ/282BpEyt/tObQO8s5CMPmYYq14uClGH4abBuQ=
github.com/evergreen-ci/shrub v0.0.0-20231121224157-600e066f9de6 h1:LfvYiC/yIi91+6ykT8yaDfmzr67vcFUbQCbRg1ZbEj4=
github.com/evergreen-ci/shrub v0.0.0-20231121224157-600e066f9de6/go.mod h1:r6YQr77CR37LMhBdWcFrxqu5V+UhO+SYloHfd9vO1go=
github.com/evergreen-ci/shrub v0.0.0-20240215220116-3f233ddeff2a h1:Hsu++nuXl8MvWhcxjQyyZtdJDv85kVrDVxf0LcUoAmQ=
github.com/evergreen-ci/shrub v0.0.0-20240215220116-3f233ddeff2a/go.mod h1:r6YQr77CR37LMhBdWcFrxqu5V+UhO+SYloHfd9vO1go=
github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs=
github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw=
github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
Expand Down Expand Up @@ -426,8 +426,8 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5y
golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA=
golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20240103183307-be819d1f06fc h1:ao2WRsKSzW6KuUY9IWPwWahcHCgR0s52IfwutMfEbdM=
golang.org/x/exp v0.0.0-20240103183307-be819d1f06fc/go.mod h1:iRJReGqOEeBhDZGkGbynYwcHlctCvnjTYIamk7uXpHI=
golang.org/x/exp v0.0.0-20240318143956-a85f2c67cd81 h1:6R2FC06FonbXQ8pK11/PDFY6N6LWlf9KlzibaCapmqc=
golang.org/x/exp v0.0.0-20240318143956-a85f2c67cd81/go.mod h1:CQ1k9gNrJ50XIzaKCRR2hssIjF07kZFEiieALBM/ARQ=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
Expand Down
2 changes: 1 addition & 1 deletion internal/cli/atlas/networking/peering/create/azure.go
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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: 3 additions & 1 deletion internal/podman/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,9 @@ func (o *client) Diagnostics(ctx context.Context) *Diagnostic {
info, err := o.machineInspect(ctx)
if err != nil {
d.MachineFound = false
d.Errors = append(d.Errors, fmt.Errorf("failed to detect podman machine: %w", err).Error())
if d.MachineRequired {
d.Errors = append(d.Errors, fmt.Sprintf("failed to detect podman machine: %s", err))
}
} else {
d.MachineInfo = info
d.MachineState = info.State
Expand Down
9 changes: 1 addition & 8 deletions internal/store/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,14 +321,7 @@ func New(opts ...Option) (*Store, error) {
if err != nil {
return nil, err
}

switch store.service {
case config.CloudService, config.CloudGovService:
err = store.setAtlasClient(client)
default:
return nil, fmt.Errorf("%w: %s", errUnsupportedService, store.service)
}
if err != nil {
if err = store.setAtlasClient(client); err != nil {
return nil, err
}

Expand Down
4 changes: 2 additions & 2 deletions tools/templates-checker/templateparsing/templateparsing.go
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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

0 comments on commit 8c218d9

Please sign in to comment.