From 33119d980ee241b3bb6153000ae59cff76e25ef4 Mon Sep 17 00:00:00 2001 From: ReallyLiri Date: Thu, 13 Jun 2024 11:47:06 +0300 Subject: [PATCH] rename internal pkg --- cmd/kubectx/current.go | 2 +- cmd/kubectx/delete.go | 4 ++-- cmd/kubectx/flags.go | 2 +- cmd/kubectx/fzf.go | 8 ++++---- cmd/kubectx/list.go | 6 +++--- cmd/kubectx/main.go | 6 +++--- cmd/kubectx/rename.go | 4 ++-- cmd/kubectx/state.go | 2 +- cmd/kubectx/state_test.go | 2 +- cmd/kubectx/switch.go | 4 ++-- cmd/kubectx/unset.go | 4 ++-- cmd/kubens/current.go | 2 +- cmd/kubens/flags.go | 2 +- cmd/kubens/fzf.go | 8 ++++---- cmd/kubens/list.go | 4 ++-- cmd/kubens/main.go | 6 +++--- cmd/kubens/statefile.go | 2 +- cmd/kubens/statefile_test.go | 2 +- cmd/kubens/switch.go | 4 ++-- {internal => core}/cmdutil/deprecated.go | 2 +- {internal => core}/cmdutil/deprecated_test.go | 0 {internal => core}/cmdutil/interactive.go | 2 +- {internal => core}/cmdutil/util.go | 0 {internal => core}/cmdutil/util_test.go | 2 +- {internal => core}/env/constants.go | 0 {internal => core}/kubeconfig/contextmodify.go | 0 {internal => core}/kubeconfig/contextmodify_test.go | 2 +- {internal => core}/kubeconfig/contexts.go | 0 {internal => core}/kubeconfig/contexts_test.go | 2 +- {internal => core}/kubeconfig/currentcontext.go | 0 {internal => core}/kubeconfig/currentcontext_test.go | 2 +- {internal => core}/kubeconfig/helper_test.go | 0 {internal => core}/kubeconfig/kubeconfig.go | 0 {internal => core}/kubeconfig/kubeconfig_test.go | 2 +- {internal => core}/kubeconfig/kubeconfigloader.go | 2 +- {internal => core}/kubeconfig/kubeconfigloader_test.go | 4 ++-- {internal => core}/kubeconfig/namespace.go | 0 {internal => core}/kubeconfig/namespace_test.go | 2 +- {internal => core}/printer/color.go | 2 +- {internal => core}/printer/color_test.go | 2 +- {internal => core}/printer/printer.go | 0 {internal => core}/testutil/kubeconfigbuilder.go | 0 {internal => core}/testutil/tempfile.go | 0 {internal => core}/testutil/testutil.go | 0 44 files changed, 50 insertions(+), 50 deletions(-) rename {internal => core}/cmdutil/deprecated.go (95%) rename {internal => core}/cmdutil/deprecated_test.go (100%) rename {internal => core}/cmdutil/interactive.go (96%) rename {internal => core}/cmdutil/util.go (100%) rename {internal => core}/cmdutil/util_test.go (97%) rename {internal => core}/env/constants.go (100%) rename {internal => core}/kubeconfig/contextmodify.go (100%) rename {internal => core}/kubeconfig/contextmodify_test.go (99%) rename {internal => core}/kubeconfig/contexts.go (100%) rename {internal => core}/kubeconfig/contexts_test.go (98%) rename {internal => core}/kubeconfig/currentcontext.go (100%) rename {internal => core}/kubeconfig/currentcontext_test.go (97%) rename {internal => core}/kubeconfig/helper_test.go (100%) rename {internal => core}/kubeconfig/kubeconfig.go (100%) rename {internal => core}/kubeconfig/kubeconfig_test.go (97%) rename {internal => core}/kubeconfig/kubeconfigloader.go (97%) rename {internal => core}/kubeconfig/kubeconfigloader_test.go (95%) rename {internal => core}/kubeconfig/namespace.go (100%) rename {internal => core}/kubeconfig/namespace_test.go (98%) rename {internal => core}/printer/color.go (97%) rename {internal => core}/printer/color_test.go (96%) rename {internal => core}/printer/printer.go (100%) rename {internal => core}/testutil/kubeconfigbuilder.go (100%) rename {internal => core}/testutil/tempfile.go (100%) rename {internal => core}/testutil/testutil.go (100%) diff --git a/cmd/kubectx/current.go b/cmd/kubectx/current.go index 4bfcb7c..28cfc17 100644 --- a/cmd/kubectx/current.go +++ b/cmd/kubectx/current.go @@ -20,7 +20,7 @@ import ( "github.com/pkg/errors" - "github.com/ahmetb/kubectx/internal/kubeconfig" + "github.com/ahmetb/kubectx/core/kubeconfig" ) // CurrentOp prints the current context diff --git a/cmd/kubectx/delete.go b/cmd/kubectx/delete.go index ca5747b..ac0d7a9 100644 --- a/cmd/kubectx/delete.go +++ b/cmd/kubectx/delete.go @@ -19,8 +19,8 @@ import ( "github.com/pkg/errors" - "github.com/ahmetb/kubectx/internal/kubeconfig" - "github.com/ahmetb/kubectx/internal/printer" + "github.com/ahmetb/kubectx/core/kubeconfig" + "github.com/ahmetb/kubectx/core/printer" ) // DeleteOp indicates intention to delete contexts. diff --git a/cmd/kubectx/flags.go b/cmd/kubectx/flags.go index 060cd1c..b086441 100644 --- a/cmd/kubectx/flags.go +++ b/cmd/kubectx/flags.go @@ -20,7 +20,7 @@ import ( "os" "strings" - "github.com/ahmetb/kubectx/internal/cmdutil" + "github.com/ahmetb/kubectx/core/cmdutil" ) // UnsupportedOp indicates an unsupported flag. diff --git a/cmd/kubectx/fzf.go b/cmd/kubectx/fzf.go index 5006129..47c3a34 100644 --- a/cmd/kubectx/fzf.go +++ b/cmd/kubectx/fzf.go @@ -24,10 +24,10 @@ import ( "github.com/pkg/errors" - "github.com/ahmetb/kubectx/internal/cmdutil" - "github.com/ahmetb/kubectx/internal/env" - "github.com/ahmetb/kubectx/internal/kubeconfig" - "github.com/ahmetb/kubectx/internal/printer" + "github.com/ahmetb/kubectx/core/cmdutil" + "github.com/ahmetb/kubectx/core/env" + "github.com/ahmetb/kubectx/core/kubeconfig" + "github.com/ahmetb/kubectx/core/printer" ) type InteractiveSwitchOp struct { diff --git a/cmd/kubectx/list.go b/cmd/kubectx/list.go index f3893f1..5dd0291 100644 --- a/cmd/kubectx/list.go +++ b/cmd/kubectx/list.go @@ -21,9 +21,9 @@ import ( "facette.io/natsort" "github.com/pkg/errors" - "github.com/ahmetb/kubectx/internal/cmdutil" - "github.com/ahmetb/kubectx/internal/kubeconfig" - "github.com/ahmetb/kubectx/internal/printer" + "github.com/ahmetb/kubectx/core/cmdutil" + "github.com/ahmetb/kubectx/core/kubeconfig" + "github.com/ahmetb/kubectx/core/printer" ) // ListOp describes listing contexts. diff --git a/cmd/kubectx/main.go b/cmd/kubectx/main.go index 370fbe0..8aa9d84 100644 --- a/cmd/kubectx/main.go +++ b/cmd/kubectx/main.go @@ -19,9 +19,9 @@ import ( "io" "os" - "github.com/ahmetb/kubectx/internal/cmdutil" - "github.com/ahmetb/kubectx/internal/env" - "github.com/ahmetb/kubectx/internal/printer" + "github.com/ahmetb/kubectx/core/cmdutil" + "github.com/ahmetb/kubectx/core/env" + "github.com/ahmetb/kubectx/core/printer" "github.com/fatih/color" ) diff --git a/cmd/kubectx/rename.go b/cmd/kubectx/rename.go index 6450f39..2eff815 100644 --- a/cmd/kubectx/rename.go +++ b/cmd/kubectx/rename.go @@ -20,8 +20,8 @@ import ( "github.com/pkg/errors" - "github.com/ahmetb/kubectx/internal/kubeconfig" - "github.com/ahmetb/kubectx/internal/printer" + "github.com/ahmetb/kubectx/core/kubeconfig" + "github.com/ahmetb/kubectx/core/printer" ) // RenameOp indicates intention to rename contexts. diff --git a/cmd/kubectx/state.go b/cmd/kubectx/state.go index d657159..9123071 100644 --- a/cmd/kubectx/state.go +++ b/cmd/kubectx/state.go @@ -21,7 +21,7 @@ import ( "github.com/pkg/errors" - "github.com/ahmetb/kubectx/internal/cmdutil" + "github.com/ahmetb/kubectx/core/cmdutil" ) func kubectxPrevCtxFile() (string, error) { diff --git a/cmd/kubectx/state_test.go b/cmd/kubectx/state_test.go index 1be60d0..dc50323 100644 --- a/cmd/kubectx/state_test.go +++ b/cmd/kubectx/state_test.go @@ -20,7 +20,7 @@ import ( "path/filepath" "testing" - "github.com/ahmetb/kubectx/internal/testutil" + "github.com/ahmetb/kubectx/core/testutil" ) func Test_readLastContext_nonExistingFile(t *testing.T) { diff --git a/cmd/kubectx/switch.go b/cmd/kubectx/switch.go index 5818d7c..dc10e92 100644 --- a/cmd/kubectx/switch.go +++ b/cmd/kubectx/switch.go @@ -19,8 +19,8 @@ import ( "github.com/pkg/errors" - "github.com/ahmetb/kubectx/internal/kubeconfig" - "github.com/ahmetb/kubectx/internal/printer" + "github.com/ahmetb/kubectx/core/kubeconfig" + "github.com/ahmetb/kubectx/core/printer" ) // SwitchOp indicates intention to switch contexts. diff --git a/cmd/kubectx/unset.go b/cmd/kubectx/unset.go index ba79323..88f4a13 100644 --- a/cmd/kubectx/unset.go +++ b/cmd/kubectx/unset.go @@ -19,8 +19,8 @@ import ( "github.com/pkg/errors" - "github.com/ahmetb/kubectx/internal/kubeconfig" - "github.com/ahmetb/kubectx/internal/printer" + "github.com/ahmetb/kubectx/core/kubeconfig" + "github.com/ahmetb/kubectx/core/printer" ) // UnsetOp indicates intention to remove current-context preference. diff --git a/cmd/kubens/current.go b/cmd/kubens/current.go index 00993ce..699538f 100644 --- a/cmd/kubens/current.go +++ b/cmd/kubens/current.go @@ -20,7 +20,7 @@ import ( "github.com/pkg/errors" - "github.com/ahmetb/kubectx/internal/kubeconfig" + "github.com/ahmetb/kubectx/core/kubeconfig" ) type CurrentOp struct{} diff --git a/cmd/kubens/flags.go b/cmd/kubens/flags.go index fc3c64d..bb665e6 100644 --- a/cmd/kubens/flags.go +++ b/cmd/kubens/flags.go @@ -20,7 +20,7 @@ import ( "os" "strings" - "github.com/ahmetb/kubectx/internal/cmdutil" + "github.com/ahmetb/kubectx/core/cmdutil" ) // UnsupportedOp indicates an unsupported flag. diff --git a/cmd/kubens/fzf.go b/cmd/kubens/fzf.go index 8a49770..b0a1def 100644 --- a/cmd/kubens/fzf.go +++ b/cmd/kubens/fzf.go @@ -24,10 +24,10 @@ import ( "github.com/pkg/errors" - "github.com/ahmetb/kubectx/internal/cmdutil" - "github.com/ahmetb/kubectx/internal/env" - "github.com/ahmetb/kubectx/internal/kubeconfig" - "github.com/ahmetb/kubectx/internal/printer" + "github.com/ahmetb/kubectx/core/cmdutil" + "github.com/ahmetb/kubectx/core/env" + "github.com/ahmetb/kubectx/core/kubeconfig" + "github.com/ahmetb/kubectx/core/printer" ) type InteractiveSwitchOp struct { diff --git a/cmd/kubens/list.go b/cmd/kubens/list.go index 38ee08d..ab04055 100644 --- a/cmd/kubens/list.go +++ b/cmd/kubens/list.go @@ -26,8 +26,8 @@ import ( _ "k8s.io/client-go/plugin/pkg/client/auth" "k8s.io/client-go/tools/clientcmd" - "github.com/ahmetb/kubectx/internal/kubeconfig" - "github.com/ahmetb/kubectx/internal/printer" + "github.com/ahmetb/kubectx/core/kubeconfig" + "github.com/ahmetb/kubectx/core/printer" ) type ListOp struct{} diff --git a/cmd/kubens/main.go b/cmd/kubens/main.go index 21ba816..e1252c9 100644 --- a/cmd/kubens/main.go +++ b/cmd/kubens/main.go @@ -19,9 +19,9 @@ import ( "io" "os" - "github.com/ahmetb/kubectx/internal/cmdutil" - "github.com/ahmetb/kubectx/internal/env" - "github.com/ahmetb/kubectx/internal/printer" + "github.com/ahmetb/kubectx/core/cmdutil" + "github.com/ahmetb/kubectx/core/env" + "github.com/ahmetb/kubectx/core/printer" "github.com/fatih/color" ) diff --git a/cmd/kubens/statefile.go b/cmd/kubens/statefile.go index b4e6305..be0a571 100644 --- a/cmd/kubens/statefile.go +++ b/cmd/kubens/statefile.go @@ -22,7 +22,7 @@ import ( "runtime" "strings" - "github.com/ahmetb/kubectx/internal/cmdutil" + "github.com/ahmetb/kubectx/core/cmdutil" ) var defaultDir = filepath.Join(cmdutil.HomeDir(), ".kube", "kubens") diff --git a/cmd/kubens/statefile_test.go b/cmd/kubens/statefile_test.go index b50878d..c72233e 100644 --- a/cmd/kubens/statefile_test.go +++ b/cmd/kubens/statefile_test.go @@ -21,7 +21,7 @@ import ( "strings" "testing" - "github.com/ahmetb/kubectx/internal/testutil" + "github.com/ahmetb/kubectx/core/testutil" ) func TestNSFile(t *testing.T) { diff --git a/cmd/kubens/switch.go b/cmd/kubens/switch.go index 7568683..11a1a01 100644 --- a/cmd/kubens/switch.go +++ b/cmd/kubens/switch.go @@ -23,8 +23,8 @@ import ( errors2 "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/ahmetb/kubectx/internal/kubeconfig" - "github.com/ahmetb/kubectx/internal/printer" + "github.com/ahmetb/kubectx/core/kubeconfig" + "github.com/ahmetb/kubectx/core/printer" ) type SwitchOp struct { diff --git a/internal/cmdutil/deprecated.go b/core/cmdutil/deprecated.go similarity index 95% rename from internal/cmdutil/deprecated.go rename to core/cmdutil/deprecated.go index b4db9b3..73e7fa7 100644 --- a/internal/cmdutil/deprecated.go +++ b/core/cmdutil/deprecated.go @@ -18,7 +18,7 @@ import ( "io" "strings" - "github.com/ahmetb/kubectx/internal/printer" + "github.com/ahmetb/kubectx/core/printer" ) func PrintDeprecatedEnvWarnings(out io.Writer, vars []string) { diff --git a/internal/cmdutil/deprecated_test.go b/core/cmdutil/deprecated_test.go similarity index 100% rename from internal/cmdutil/deprecated_test.go rename to core/cmdutil/deprecated_test.go diff --git a/internal/cmdutil/interactive.go b/core/cmdutil/interactive.go similarity index 96% rename from internal/cmdutil/interactive.go rename to core/cmdutil/interactive.go index c562c12..247f1e7 100644 --- a/internal/cmdutil/interactive.go +++ b/core/cmdutil/interactive.go @@ -20,7 +20,7 @@ import ( "github.com/mattn/go-isatty" - "github.com/ahmetb/kubectx/internal/env" + "github.com/ahmetb/kubectx/core/env" ) // isTerminal determines if given fd is a TTY. diff --git a/internal/cmdutil/util.go b/core/cmdutil/util.go similarity index 100% rename from internal/cmdutil/util.go rename to core/cmdutil/util.go diff --git a/internal/cmdutil/util_test.go b/core/cmdutil/util_test.go similarity index 97% rename from internal/cmdutil/util_test.go rename to core/cmdutil/util_test.go index bf2373c..167cf12 100644 --- a/internal/cmdutil/util_test.go +++ b/core/cmdutil/util_test.go @@ -17,7 +17,7 @@ package cmdutil import ( "testing" - "github.com/ahmetb/kubectx/internal/testutil" + "github.com/ahmetb/kubectx/core/testutil" ) func Test_homeDir(t *testing.T) { diff --git a/internal/env/constants.go b/core/env/constants.go similarity index 100% rename from internal/env/constants.go rename to core/env/constants.go diff --git a/internal/kubeconfig/contextmodify.go b/core/kubeconfig/contextmodify.go similarity index 100% rename from internal/kubeconfig/contextmodify.go rename to core/kubeconfig/contextmodify.go diff --git a/internal/kubeconfig/contextmodify_test.go b/core/kubeconfig/contextmodify_test.go similarity index 99% rename from internal/kubeconfig/contextmodify_test.go rename to core/kubeconfig/contextmodify_test.go index 5079634..655f811 100644 --- a/internal/kubeconfig/contextmodify_test.go +++ b/core/kubeconfig/contextmodify_test.go @@ -19,7 +19,7 @@ import ( "github.com/google/go-cmp/cmp" - "github.com/ahmetb/kubectx/internal/testutil" + "github.com/ahmetb/kubectx/core/testutil" ) func TestKubeconfig_DeleteContextEntry_errors(t *testing.T) { diff --git a/internal/kubeconfig/contexts.go b/core/kubeconfig/contexts.go similarity index 100% rename from internal/kubeconfig/contexts.go rename to core/kubeconfig/contexts.go diff --git a/internal/kubeconfig/contexts_test.go b/core/kubeconfig/contexts_test.go similarity index 98% rename from internal/kubeconfig/contexts_test.go rename to core/kubeconfig/contexts_test.go index 28d7bc3..14a49ab 100644 --- a/internal/kubeconfig/contexts_test.go +++ b/core/kubeconfig/contexts_test.go @@ -19,7 +19,7 @@ import ( "github.com/google/go-cmp/cmp" - "github.com/ahmetb/kubectx/internal/testutil" + "github.com/ahmetb/kubectx/core/testutil" ) func TestKubeconfig_ContextNames(t *testing.T) { diff --git a/internal/kubeconfig/currentcontext.go b/core/kubeconfig/currentcontext.go similarity index 100% rename from internal/kubeconfig/currentcontext.go rename to core/kubeconfig/currentcontext.go diff --git a/internal/kubeconfig/currentcontext_test.go b/core/kubeconfig/currentcontext_test.go similarity index 97% rename from internal/kubeconfig/currentcontext_test.go rename to core/kubeconfig/currentcontext_test.go index f0db300..897d183 100644 --- a/internal/kubeconfig/currentcontext_test.go +++ b/core/kubeconfig/currentcontext_test.go @@ -17,7 +17,7 @@ package kubeconfig import ( "testing" - "github.com/ahmetb/kubectx/internal/testutil" + "github.com/ahmetb/kubectx/core/testutil" ) func TestKubeconfig_GetCurrentContext(t *testing.T) { diff --git a/internal/kubeconfig/helper_test.go b/core/kubeconfig/helper_test.go similarity index 100% rename from internal/kubeconfig/helper_test.go rename to core/kubeconfig/helper_test.go diff --git a/internal/kubeconfig/kubeconfig.go b/core/kubeconfig/kubeconfig.go similarity index 100% rename from internal/kubeconfig/kubeconfig.go rename to core/kubeconfig/kubeconfig.go diff --git a/internal/kubeconfig/kubeconfig_test.go b/core/kubeconfig/kubeconfig_test.go similarity index 97% rename from internal/kubeconfig/kubeconfig_test.go rename to core/kubeconfig/kubeconfig_test.go index b22e0fc..1566a35 100644 --- a/internal/kubeconfig/kubeconfig_test.go +++ b/core/kubeconfig/kubeconfig_test.go @@ -19,7 +19,7 @@ import ( "github.com/google/go-cmp/cmp" - "github.com/ahmetb/kubectx/internal/testutil" + "github.com/ahmetb/kubectx/core/testutil" ) func TestParse(t *testing.T) { diff --git a/internal/kubeconfig/kubeconfigloader.go b/core/kubeconfig/kubeconfigloader.go similarity index 97% rename from internal/kubeconfig/kubeconfigloader.go rename to core/kubeconfig/kubeconfigloader.go index 2fa26b8..47bc4f3 100644 --- a/internal/kubeconfig/kubeconfigloader.go +++ b/core/kubeconfig/kubeconfigloader.go @@ -15,7 +15,7 @@ package kubeconfig import ( - "github.com/ahmetb/kubectx/internal/cmdutil" + "github.com/ahmetb/kubectx/core/cmdutil" "os" "path/filepath" diff --git a/internal/kubeconfig/kubeconfigloader_test.go b/core/kubeconfig/kubeconfigloader_test.go similarity index 95% rename from internal/kubeconfig/kubeconfigloader_test.go rename to core/kubeconfig/kubeconfigloader_test.go index 348f320..45ecdf3 100644 --- a/internal/kubeconfig/kubeconfigloader_test.go +++ b/core/kubeconfig/kubeconfigloader_test.go @@ -15,13 +15,13 @@ package kubeconfig import ( - "github.com/ahmetb/kubectx/internal/cmdutil" + "github.com/ahmetb/kubectx/core/cmdutil" "os" "path/filepath" "strings" "testing" - "github.com/ahmetb/kubectx/internal/testutil" + "github.com/ahmetb/kubectx/core/testutil" ) func Test_kubeconfigPath(t *testing.T) { diff --git a/internal/kubeconfig/namespace.go b/core/kubeconfig/namespace.go similarity index 100% rename from internal/kubeconfig/namespace.go rename to core/kubeconfig/namespace.go diff --git a/internal/kubeconfig/namespace_test.go b/core/kubeconfig/namespace_test.go similarity index 98% rename from internal/kubeconfig/namespace_test.go rename to core/kubeconfig/namespace_test.go index adb3faf..097069d 100644 --- a/internal/kubeconfig/namespace_test.go +++ b/core/kubeconfig/namespace_test.go @@ -19,7 +19,7 @@ import ( "github.com/google/go-cmp/cmp" - "github.com/ahmetb/kubectx/internal/testutil" + "github.com/ahmetb/kubectx/core/testutil" ) func TestKubeconfig_NamespaceOfContext_ctxNotFound(t *testing.T) { diff --git a/internal/printer/color.go b/core/printer/color.go similarity index 97% rename from internal/printer/color.go rename to core/printer/color.go index 488553a..0d5ffbc 100644 --- a/internal/printer/color.go +++ b/core/printer/color.go @@ -19,7 +19,7 @@ import ( "github.com/fatih/color" - "github.com/ahmetb/kubectx/internal/env" + "github.com/ahmetb/kubectx/core/env" ) var ( diff --git a/internal/printer/color_test.go b/core/printer/color_test.go similarity index 96% rename from internal/printer/color_test.go rename to core/printer/color_test.go index 9991c72..bf2a927 100644 --- a/internal/printer/color_test.go +++ b/core/printer/color_test.go @@ -19,7 +19,7 @@ import ( "github.com/google/go-cmp/cmp" - "github.com/ahmetb/kubectx/internal/testutil" + "github.com/ahmetb/kubectx/core/testutil" ) var ( diff --git a/internal/printer/printer.go b/core/printer/printer.go similarity index 100% rename from internal/printer/printer.go rename to core/printer/printer.go diff --git a/internal/testutil/kubeconfigbuilder.go b/core/testutil/kubeconfigbuilder.go similarity index 100% rename from internal/testutil/kubeconfigbuilder.go rename to core/testutil/kubeconfigbuilder.go diff --git a/internal/testutil/tempfile.go b/core/testutil/tempfile.go similarity index 100% rename from internal/testutil/tempfile.go rename to core/testutil/tempfile.go diff --git a/internal/testutil/testutil.go b/core/testutil/testutil.go similarity index 100% rename from internal/testutil/testutil.go rename to core/testutil/testutil.go