Skip to content

Commit

Permalink
Linter - sharedApi (#1537)
Browse files Browse the repository at this point in the history
  • Loading branch information
jwierzbo authored Dec 12, 2023
1 parent 93e6af5 commit 384fd6a
Show file tree
Hide file tree
Showing 158 changed files with 323 additions and 315 deletions.
8 changes: 8 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,16 @@ linters-settings:
alias: batch
- pkg: k8s.io/api/storage/v1
alias: storage
- pkg: github.com/arangodb/kube-arangodb/pkg/deployment/reconcile/shared
alias: sharedReconcile
- pkg: k8s.io/api/policy/v1
alias: policy
- pkg: github.com/arangodb/kube-arangodb/pkg/apis/shared/v1
alias: sharedApi
- pkg: github.com/arangodb/kube-arangodb/pkg/apis/shared
alias: shared
- pkg: github.com/arangodb/kube-arangodb/pkg/handlers/enterprise/ml/shared
alias: mlShared
- pkg: github.com/arangodb/kube-arangodb/pkg/apis/ml/v1alpha1
alias: mlApi
gci:
Expand Down
2 changes: 1 addition & 1 deletion cmd/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import (
"github.com/arangodb/go-driver/v2/connection"

api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
"github.com/arangodb/kube-arangodb/pkg/apis/shared"
shared "github.com/arangodb/kube-arangodb/pkg/apis/shared"
"github.com/arangodb/kube-arangodb/pkg/util/constants"
"github.com/arangodb/kube-arangodb/pkg/util/errors"
"github.com/arangodb/kube-arangodb/pkg/util/globals"
Expand Down
4 changes: 2 additions & 2 deletions cmd/lifecycle.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// DISCLAIMER
//
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -32,7 +32,7 @@ import (
"github.com/spf13/cobra"
meta "k8s.io/apimachinery/pkg/apis/meta/v1"

"github.com/arangodb/kube-arangodb/pkg/apis/shared"
shared "github.com/arangodb/kube-arangodb/pkg/apis/shared"
"github.com/arangodb/kube-arangodb/pkg/handlers/utils"
"github.com/arangodb/kube-arangodb/pkg/util/constants"
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/kerrors"
Expand Down
4 changes: 2 additions & 2 deletions cmd/lifecycle_probes.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// DISCLAIMER
//
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -38,7 +38,7 @@ import (
"github.com/arangodb/go-driver/jwt"

api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
"github.com/arangodb/kube-arangodb/pkg/apis/shared"
shared "github.com/arangodb/kube-arangodb/pkg/apis/shared"
"github.com/arangodb/kube-arangodb/pkg/deployment/client"
"github.com/arangodb/kube-arangodb/pkg/deployment/features"
"github.com/arangodb/kube-arangodb/pkg/deployment/pod"
Expand Down
4 changes: 2 additions & 2 deletions cmd/lifecycle_startup.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// DISCLAIMER
//
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -28,7 +28,7 @@ import (

"github.com/spf13/cobra"

"github.com/arangodb/kube-arangodb/pkg/apis/shared"
shared "github.com/arangodb/kube-arangodb/pkg/apis/shared"
)

var cmdLifecycleStartup = &cobra.Command{
Expand Down
6 changes: 3 additions & 3 deletions pkg/apis/backup/v1/backup_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ package v1
import (
meta "k8s.io/apimachinery/pkg/apis/meta/v1"

shared "github.com/arangodb/kube-arangodb/pkg/apis/shared/v1"
sharedApi "github.com/arangodb/kube-arangodb/pkg/apis/shared/v1"
)

// ArangoBackupStatus contains the status part of
Expand Down Expand Up @@ -66,8 +66,8 @@ type ArangoBackupDetails struct {
Downloaded *bool `json:"downloaded,omitempty"`
Imported *bool `json:"imported,omitempty"`
// CreationTimestamp ArangoBackup Custom Resource creation time in UTC
CreationTimestamp meta.Time `json:"createdAt"`
Keys shared.HashList `json:"keys,omitempty"`
CreationTimestamp meta.Time `json:"createdAt"`
Keys sharedApi.HashList `json:"keys,omitempty"`
}

func (a *ArangoBackupDetails) Equal(b *ArangoBackupDetails) bool {
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/deployment/v1/architecture.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
"github.com/pkg/errors"
core "k8s.io/api/core/v1"

"github.com/arangodb/kube-arangodb/pkg/apis/shared"
shared "github.com/arangodb/kube-arangodb/pkg/apis/shared"
)

// ArangoDeploymentArchitecture defines the list of supported architectures.
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/deployment/v1/authentication_spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
package v1

import (
"github.com/arangodb/kube-arangodb/pkg/apis/shared"
shared "github.com/arangodb/kube-arangodb/pkg/apis/shared"
"github.com/arangodb/kube-arangodb/pkg/util"
"github.com/arangodb/kube-arangodb/pkg/util/errors"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/deployment/v1/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
package v1

import (
"github.com/arangodb/kube-arangodb/pkg/apis/shared"
shared "github.com/arangodb/kube-arangodb/pkg/apis/shared"
"github.com/arangodb/kube-arangodb/pkg/util/errors"
)

Expand Down
4 changes: 2 additions & 2 deletions pkg/apis/deployment/v1/cluster_synchronization_spec.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// DISCLAIMER
//
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -23,7 +23,7 @@ package v1
import (
"github.com/pkg/errors"

"github.com/arangodb/kube-arangodb/pkg/apis/shared"
shared "github.com/arangodb/kube-arangodb/pkg/apis/shared"
)

type ArangoClusterSynchronizationSpec struct {
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/deployment/v1/deployment_metrics_spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ package v1
import (
core "k8s.io/api/core/v1"

"github.com/arangodb/kube-arangodb/pkg/apis/shared"
shared "github.com/arangodb/kube-arangodb/pkg/apis/shared"
"github.com/arangodb/kube-arangodb/pkg/util"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/deployment/v1/deployment_spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (

core "k8s.io/api/core/v1"

"github.com/arangodb/kube-arangodb/pkg/apis/shared"
shared "github.com/arangodb/kube-arangodb/pkg/apis/shared"
"github.com/arangodb/kube-arangodb/pkg/handlers/utils"
"github.com/arangodb/kube-arangodb/pkg/util"
"github.com/arangodb/kube-arangodb/pkg/util/errors"
Expand Down
14 changes: 7 additions & 7 deletions pkg/apis/deployment/v1/hashes.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// DISCLAIMER
//
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -20,7 +20,7 @@

package v1

import shared "github.com/arangodb/kube-arangodb/pkg/apis/shared/v1"
import sharedApi "github.com/arangodb/kube-arangodb/pkg/apis/shared/v1"

type DeploymentStatusHashes struct {
Encryption DeploymentStatusHashesEncryption `json:"rocksDBEncryption,omitempty"`
Expand All @@ -29,21 +29,21 @@ type DeploymentStatusHashes struct {
}

type DeploymentStatusHashesEncryption struct {
Keys shared.HashList `json:"keys,omitempty"`
Keys sharedApi.HashList `json:"keys,omitempty"`

Propagated bool `json:"propagated,omitempty"`
}

type DeploymentStatusHashesTLS struct {
CA *string `json:"ca,omitempty"`
Truststore shared.HashList `json:"truststore,omitempty"`
CA *string `json:"ca,omitempty"`
Truststore sharedApi.HashList `json:"truststore,omitempty"`

Propagated bool `json:"propagated,omitempty"`
}

type DeploymentStatusHashesJWT struct {
Active string `json:"active,omitempty"`
Passive shared.HashList `json:"passive,omitempty"`
Active string `json:"active,omitempty"`
Passive sharedApi.HashList `json:"passive,omitempty"`

Propagated bool `json:"propagated,omitempty"`
}
2 changes: 1 addition & 1 deletion pkg/apis/deployment/v1/license_spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
package v1

import (
"github.com/arangodb/kube-arangodb/pkg/apis/shared"
shared "github.com/arangodb/kube-arangodb/pkg/apis/shared"
"github.com/arangodb/kube-arangodb/pkg/util"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/deployment/v1/member_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (

driver "github.com/arangodb/go-driver"

"github.com/arangodb/kube-arangodb/pkg/apis/shared"
shared "github.com/arangodb/kube-arangodb/pkg/apis/shared"
"github.com/arangodb/kube-arangodb/pkg/util"
"github.com/arangodb/kube-arangodb/pkg/util/strings"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/deployment/v1/rocksdb_spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
package v1

import (
"github.com/arangodb/kube-arangodb/pkg/apis/shared"
shared "github.com/arangodb/kube-arangodb/pkg/apis/shared"
"github.com/arangodb/kube-arangodb/pkg/util"
"github.com/arangodb/kube-arangodb/pkg/util/errors"
)
Expand Down
6 changes: 3 additions & 3 deletions pkg/apis/deployment/v1/server_group_init_containers.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ package v1
import (
core "k8s.io/api/core/v1"

"github.com/arangodb/kube-arangodb/pkg/apis/shared"
sharedv1 "github.com/arangodb/kube-arangodb/pkg/apis/shared/v1"
shared "github.com/arangodb/kube-arangodb/pkg/apis/shared"
sharedApi "github.com/arangodb/kube-arangodb/pkg/apis/shared/v1"
"github.com/arangodb/kube-arangodb/pkg/util/errors"
)

Expand All @@ -51,7 +51,7 @@ func ValidateServerGroupInitContainerName(name string) error {
return errors.Newf("InitContainer name %s is restricted", name)
}

return sharedv1.AsKubernetesResourceName(&name).Validate()
return sharedApi.AsKubernetesResourceName(&name).Validate()
}

type ServerGroupInitContainerMode string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
core "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/util/intstr"

"github.com/arangodb/kube-arangodb/pkg/apis/shared"
shared "github.com/arangodb/kube-arangodb/pkg/apis/shared"
"github.com/arangodb/kube-arangodb/pkg/util"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
core "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/util/intstr"

"github.com/arangodb/kube-arangodb/pkg/apis/shared"
shared "github.com/arangodb/kube-arangodb/pkg/apis/shared"
"github.com/arangodb/kube-arangodb/pkg/util"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/deployment/v1/server_group_spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
core "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"

"github.com/arangodb/kube-arangodb/pkg/apis/shared"
shared "github.com/arangodb/kube-arangodb/pkg/apis/shared"
"github.com/arangodb/kube-arangodb/pkg/util"
arangodOptions "github.com/arangodb/kube-arangodb/pkg/util/arangod/options"
arangosyncOptions "github.com/arangodb/kube-arangodb/pkg/util/arangosync/options"
Expand Down
12 changes: 6 additions & 6 deletions pkg/apis/deployment/v1/server_group_volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import (
core "k8s.io/api/core/v1"
meta "k8s.io/apimachinery/pkg/apis/meta/v1"

"github.com/arangodb/kube-arangodb/pkg/apis/shared"
sharedv1 "github.com/arangodb/kube-arangodb/pkg/apis/shared/v1"
shared "github.com/arangodb/kube-arangodb/pkg/apis/shared"
sharedApi "github.com/arangodb/kube-arangodb/pkg/apis/shared/v1"
"github.com/arangodb/kube-arangodb/pkg/util/errors"
)

Expand Down Expand Up @@ -160,7 +160,7 @@ func (s *ServerGroupSpecVolume) Validate() error {
}

return shared.WithErrors(
shared.PrefixResourceErrors("name", sharedv1.AsKubernetesResourceName(&s.Name).Validate()),
shared.PrefixResourceErrors("name", sharedApi.AsKubernetesResourceName(&s.Name).Validate()),
shared.PrefixResourceErrors("secret", s.Secret.Validate()),
shared.PrefixResourceErrors("configMap", s.ConfigMap.Validate()),
shared.PrefixResourceErrors("emptyDir", s.EmptyDir.Validate()),
Expand Down Expand Up @@ -265,7 +265,7 @@ func (s *ServerGroupSpecVolumeSecret) Validate() error {
}

return shared.WithErrors(
shared.PrefixResourceError("secretName", sharedv1.AsKubernetesResourceName(&q.SecretName).Validate()),
shared.PrefixResourceError("secretName", sharedApi.AsKubernetesResourceName(&q.SecretName).Validate()),
)
}

Expand Down Expand Up @@ -298,7 +298,7 @@ func (s *ServerGroupSpecVolumeConfigMap) Validate() error {
}

return shared.WithErrors(
shared.PrefixResourceError("name", sharedv1.AsKubernetesResourceName(&q.Name).Validate()),
shared.PrefixResourceError("name", sharedApi.AsKubernetesResourceName(&q.Name).Validate()),
)
}

Expand Down Expand Up @@ -363,7 +363,7 @@ func (s *ServerGroupSpecVolumePersistentVolumeClaim) Validate() error {
}

return shared.WithErrors(
shared.PrefixResourceError("claimName", sharedv1.AsKubernetesResourceName(&q.ClaimName).Validate()),
shared.PrefixResourceError("claimName", sharedApi.AsKubernetesResourceName(&q.ClaimName).Validate()),
)
}

Expand Down
8 changes: 4 additions & 4 deletions pkg/apis/deployment/v1/server_group_volume_mount.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// DISCLAIMER
//
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -25,8 +25,8 @@ import (

core "k8s.io/api/core/v1"

"github.com/arangodb/kube-arangodb/pkg/apis/shared"
sharedv1 "github.com/arangodb/kube-arangodb/pkg/apis/shared/v1"
shared "github.com/arangodb/kube-arangodb/pkg/apis/shared"
sharedApi "github.com/arangodb/kube-arangodb/pkg/apis/shared/v1"
)

type ServerGroupSpecVolumeMounts []ServerGroupSpecVolumeMount
Expand Down Expand Up @@ -67,6 +67,6 @@ func (s *ServerGroupSpecVolumeMount) Validate() error {
}

return shared.WithErrors(
shared.PrefixResourceError("name", sharedv1.AsKubernetesResourceName(&s.Name).Validate()),
shared.PrefixResourceError("name", sharedApi.AsKubernetesResourceName(&s.Name).Validate()),
)
}
4 changes: 2 additions & 2 deletions pkg/apis/deployment/v1/server_group_volume_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// DISCLAIMER
//
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -27,7 +27,7 @@ import (
"github.com/stretchr/testify/require"
core "k8s.io/api/core/v1"

"github.com/arangodb/kube-arangodb/pkg/apis/shared"
shared "github.com/arangodb/kube-arangodb/pkg/apis/shared"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/deployment/v1/sync_authentication_spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
package v1

import (
"github.com/arangodb/kube-arangodb/pkg/apis/shared"
shared "github.com/arangodb/kube-arangodb/pkg/apis/shared"
"github.com/arangodb/kube-arangodb/pkg/util"
"github.com/arangodb/kube-arangodb/pkg/util/errors"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/deployment/v1/sync_external_access_spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"net/url"
"strconv"

"github.com/arangodb/kube-arangodb/pkg/apis/shared"
shared "github.com/arangodb/kube-arangodb/pkg/apis/shared"
"github.com/arangodb/kube-arangodb/pkg/util/errors"
)

Expand Down
Loading

0 comments on commit 384fd6a

Please sign in to comment.