From 6a7e541b82e289c8740085b5651cdac13357f0d8 Mon Sep 17 00:00:00 2001 From: Nikolai Rodionov Date: Thu, 12 Oct 2023 11:53:58 +0200 Subject: [PATCH] WIP: Move public objects to the pkg dir --- internal/controller/controller.go | 6 +++--- internal/providers/flux.go | 5 ++--- internal/utils/diff/diff.go | 6 +++--- internal/utils/helmhelper/helm.go | 2 +- internal/utils/helmhelper/mock.go | 2 +- internal/utils/helmhelper/types.go | 2 +- {internal/config => pkg}/cluster/cluster.go | 4 ++-- {internal/config => pkg}/cluster/cluster_test.go | 0 {internal => pkg}/config/config.go | 6 +++--- {internal => pkg}/config/config_test.go | 4 ++-- {internal => pkg}/lockfile/lockfile.go | 2 +- {internal/config => pkg}/release/release.go | 4 ++-- {internal/config => pkg}/release/release_test.go | 4 ++-- {internal/config => pkg}/repository/repository.go | 0 {internal/config => pkg}/repository/repository_test.go | 2 +- 15 files changed, 24 insertions(+), 25 deletions(-) rename {internal/config => pkg}/cluster/cluster.go (93%) rename {internal/config => pkg}/cluster/cluster_test.go (100%) rename {internal => pkg}/config/config.go (76%) rename {internal => pkg}/config/config_test.go (87%) rename {internal => pkg}/lockfile/lockfile.go (96%) rename {internal/config => pkg}/release/release.go (97%) rename {internal/config => pkg}/release/release_test.go (94%) rename {internal/config => pkg}/repository/repository.go (100%) rename {internal/config => pkg}/repository/repository_test.go (96%) diff --git a/internal/controller/controller.go b/internal/controller/controller.go index f9f18ff..a6c49a4 100644 --- a/internal/controller/controller.go +++ b/internal/controller/controller.go @@ -4,9 +4,6 @@ import ( "fmt" "path/filepath" - "git.badhouseplants.net/allanger/shoebill/internal/config" - "git.badhouseplants.net/allanger/shoebill/internal/config/release" - "git.badhouseplants.net/allanger/shoebill/internal/lockfile" "git.badhouseplants.net/allanger/shoebill/internal/providers" "git.badhouseplants.net/allanger/shoebill/internal/utils/diff" "git.badhouseplants.net/allanger/shoebill/internal/utils/githelper" @@ -14,6 +11,9 @@ import ( "git.badhouseplants.net/allanger/shoebill/internal/utils/kustomize" "git.badhouseplants.net/allanger/shoebill/internal/utils/sopshelper" "git.badhouseplants.net/allanger/shoebill/internal/utils/workdir" + "git.badhouseplants.net/allanger/shoebill/pkg/config" + "git.badhouseplants.net/allanger/shoebill/pkg/lockfile" + "git.badhouseplants.net/allanger/shoebill/pkg/release" ) func ReadTheConfig(path string) (*config.Config, error) { diff --git a/internal/providers/flux.go b/internal/providers/flux.go index d8b0e67..8f182b1 100644 --- a/internal/providers/flux.go +++ b/internal/providers/flux.go @@ -8,13 +8,12 @@ import ( "os/exec" "path/filepath" - "git.badhouseplants.net/allanger/shoebill/internal/config/release" - "git.badhouseplants.net/allanger/shoebill/internal/config/repository" "git.badhouseplants.net/allanger/shoebill/internal/utils/diff" "git.badhouseplants.net/allanger/shoebill/internal/utils/githelper" + "git.badhouseplants.net/allanger/shoebill/pkg/release" + "git.badhouseplants.net/allanger/shoebill/pkg/repository" release_v2beta1 "github.com/fluxcd/helm-controller/api/v2beta1" helmrepo_v1beta2 "github.com/fluxcd/source-controller/api/v1beta2" - "github.com/sirupsen/logrus" corev1 "k8s.io/api/core/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "sigs.k8s.io/yaml" diff --git a/internal/utils/diff/diff.go b/internal/utils/diff/diff.go index 6c0a48f..45f5654 100644 --- a/internal/utils/diff/diff.go +++ b/internal/utils/diff/diff.go @@ -3,9 +3,9 @@ package diff import ( "reflect" - "git.badhouseplants.net/allanger/shoebill/internal/config/release" - "git.badhouseplants.net/allanger/shoebill/internal/config/repository" - "git.badhouseplants.net/allanger/shoebill/internal/lockfile" + "git.badhouseplants.net/allanger/shoebill/pkg/lockfile" + "git.badhouseplants.net/allanger/shoebill/pkg/release" + "git.badhouseplants.net/allanger/shoebill/pkg/repository" "github.com/sirupsen/logrus" ) diff --git a/internal/utils/helmhelper/helm.go b/internal/utils/helmhelper/helm.go index 3367471..57cf499 100644 --- a/internal/utils/helmhelper/helm.go +++ b/internal/utils/helmhelper/helm.go @@ -4,7 +4,7 @@ import ( "fmt" "os" - "git.badhouseplants.net/allanger/shoebill/internal/config/repository" + "git.badhouseplants.net/allanger/shoebill/pkg/repository" "github.com/sirupsen/logrus" "gopkg.in/yaml.v2" "helm.sh/helm/v3/pkg/action" diff --git a/internal/utils/helmhelper/mock.go b/internal/utils/helmhelper/mock.go index 48dfea2..2ab94cd 100644 --- a/internal/utils/helmhelper/mock.go +++ b/internal/utils/helmhelper/mock.go @@ -1,6 +1,6 @@ package helmhelper -import "git.badhouseplants.net/allanger/shoebill/internal/config/repository" +import "git.badhouseplants.net/allanger/shoebill/pkg/repository" const MOCK_LATEST_VERSION = "v1.12.1" diff --git a/internal/utils/helmhelper/types.go b/internal/utils/helmhelper/types.go index dc7dc57..55d55ef 100644 --- a/internal/utils/helmhelper/types.go +++ b/internal/utils/helmhelper/types.go @@ -1,6 +1,6 @@ package helmhelper -import "git.badhouseplants.net/allanger/shoebill/internal/config/repository" +import "git.badhouseplants.net/allanger/shoebill/pkg/repository" type Helmhelper interface { FindLatestVersion(dir, chart string, repository repository.Repository) (string, error) diff --git a/internal/config/cluster/cluster.go b/pkg/cluster/cluster.go similarity index 93% rename from internal/config/cluster/cluster.go rename to pkg/cluster/cluster.go index 145720e..95f1647 100644 --- a/internal/config/cluster/cluster.go +++ b/pkg/cluster/cluster.go @@ -5,9 +5,9 @@ import ( "fmt" "os" - "git.badhouseplants.net/allanger/shoebill/internal/config/release" - "git.badhouseplants.net/allanger/shoebill/internal/lockfile" "git.badhouseplants.net/allanger/shoebill/internal/utils/githelper" + "git.badhouseplants.net/allanger/shoebill/pkg/lockfile" + "git.badhouseplants.net/allanger/shoebill/pkg/release" ) type Cluster struct { diff --git a/internal/config/cluster/cluster_test.go b/pkg/cluster/cluster_test.go similarity index 100% rename from internal/config/cluster/cluster_test.go rename to pkg/cluster/cluster_test.go diff --git a/internal/config/config.go b/pkg/config/config.go similarity index 76% rename from internal/config/config.go rename to pkg/config/config.go index fff65be..1493b14 100644 --- a/internal/config/config.go +++ b/pkg/config/config.go @@ -3,9 +3,9 @@ package config import ( "os" - "git.badhouseplants.net/allanger/shoebill/internal/config/cluster" - "git.badhouseplants.net/allanger/shoebill/internal/config/release" - "git.badhouseplants.net/allanger/shoebill/internal/config/repository" + "git.badhouseplants.net/allanger/shoebill/pkg/cluster" + "git.badhouseplants.net/allanger/shoebill/pkg/release" + "git.badhouseplants.net/allanger/shoebill/pkg/repository" "github.com/sirupsen/logrus" "gopkg.in/yaml.v2" ) diff --git a/internal/config/config_test.go b/pkg/config/config_test.go similarity index 87% rename from internal/config/config_test.go rename to pkg/config/config_test.go index 01feb51..9432c6e 100644 --- a/internal/config/config_test.go +++ b/pkg/config/config_test.go @@ -4,8 +4,8 @@ import ( "os" "testing" - "git.badhouseplants.net/allanger/shoebill/internal/config" - "git.badhouseplants.net/allanger/shoebill/internal/config/repository" + "git.badhouseplants.net/allanger/shoebill/pkg/config" + "git.badhouseplants.net/allanger/shoebill/pkg/repository" "github.com/stretchr/testify/assert" ) diff --git a/internal/lockfile/lockfile.go b/pkg/lockfile/lockfile.go similarity index 96% rename from internal/lockfile/lockfile.go rename to pkg/lockfile/lockfile.go index 9a2f463..2ce9246 100644 --- a/internal/lockfile/lockfile.go +++ b/pkg/lockfile/lockfile.go @@ -4,7 +4,7 @@ import ( "fmt" "os" - "git.badhouseplants.net/allanger/shoebill/internal/config/repository" + "git.badhouseplants.net/allanger/shoebill/pkg/repository" "github.com/sirupsen/logrus" "gopkg.in/yaml.v2" ) diff --git a/internal/config/release/release.go b/pkg/release/release.go similarity index 97% rename from internal/config/release/release.go rename to pkg/release/release.go index 32f100e..d47f013 100644 --- a/internal/config/release/release.go +++ b/pkg/release/release.go @@ -5,10 +5,10 @@ import ( "reflect" "strings" - "git.badhouseplants.net/allanger/shoebill/internal/config/repository" - "git.badhouseplants.net/allanger/shoebill/internal/lockfile" "git.badhouseplants.net/allanger/shoebill/internal/utils/helmhelper" "git.badhouseplants.net/allanger/shoebill/internal/utils/sopshelper" + "git.badhouseplants.net/allanger/shoebill/pkg/lockfile" + "git.badhouseplants.net/allanger/shoebill/pkg/repository" "github.com/sirupsen/logrus" ) diff --git a/internal/config/release/release_test.go b/pkg/release/release_test.go similarity index 94% rename from internal/config/release/release_test.go rename to pkg/release/release_test.go index 786d9ae..1dd13f5 100644 --- a/internal/config/release/release_test.go +++ b/pkg/release/release_test.go @@ -4,9 +4,9 @@ import ( "fmt" "testing" - "git.badhouseplants.net/allanger/shoebill/internal/config/release" - "git.badhouseplants.net/allanger/shoebill/internal/config/repository" "git.badhouseplants.net/allanger/shoebill/internal/utils/helmhelper" + "git.badhouseplants.net/allanger/shoebill/pkg/release" + "git.badhouseplants.net/allanger/shoebill/pkg/repository" "github.com/stretchr/testify/assert" "gopkg.in/yaml.v2" ) diff --git a/internal/config/repository/repository.go b/pkg/repository/repository.go similarity index 100% rename from internal/config/repository/repository.go rename to pkg/repository/repository.go diff --git a/internal/config/repository/repository_test.go b/pkg/repository/repository_test.go similarity index 96% rename from internal/config/repository/repository_test.go rename to pkg/repository/repository_test.go index 1e3849c..e45e6b9 100644 --- a/internal/config/repository/repository_test.go +++ b/pkg/repository/repository_test.go @@ -4,7 +4,7 @@ import ( "fmt" "testing" - "git.badhouseplants.net/allanger/shoebill/internal/config/repository" + "git.badhouseplants.net/allanger/shoebill/pkg/repository" "github.com/stretchr/testify/assert" )