From 62578ad5c5f55a5029051a441036cf6fc15f6201 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20T=C3=B6lle?= Date: Thu, 2 May 2024 21:18:20 +0200 Subject: [PATCH] refactor: yeet util/ subdirs --- cmd/hcloud-image/cmd/root.go | 4 ++-- cmd/hcloud-image/cmd/upload.go | 2 +- cmd/hcloud-image/main.go | 2 +- cmd/hcloud-image/{util => }/ui/slog_handler.go | 0 {util/contextlogger => contextlogger}/context.go | 0 {util/contextlogger => contextlogger}/discard.go | 0 {util/control => control}/retry.go | 2 +- {util/randomid => randomid}/randomid.go | 0 {util/randomid => randomid}/randomid_test.go | 0 snapshot.go | 10 +++++----- {util/sshkey => sshkey}/ssh_key.go | 0 {util/sshkey => sshkey}/ssh_key_test.go | 0 {util/sshsession => sshsession}/session.go | 0 13 files changed, 10 insertions(+), 10 deletions(-) rename cmd/hcloud-image/{util => }/ui/slog_handler.go (100%) rename {util/contextlogger => contextlogger}/context.go (100%) rename {util/contextlogger => contextlogger}/discard.go (100%) rename {util/control => control}/retry.go (95%) rename {util/randomid => randomid}/randomid.go (100%) rename {util/randomid => randomid}/randomid_test.go (100%) rename {util/sshkey => sshkey}/ssh_key.go (100%) rename {util/sshkey => sshkey}/ssh_key_test.go (100%) rename {util/sshsession => sshsession}/session.go (100%) diff --git a/cmd/hcloud-image/cmd/root.go b/cmd/hcloud-image/cmd/root.go index cab39b1..61537f2 100644 --- a/cmd/hcloud-image/cmd/root.go +++ b/cmd/hcloud-image/cmd/root.go @@ -11,8 +11,8 @@ import ( "github.com/spf13/cobra" hcloud_upload_image "github.com/apricote/hcloud-upload-image" - "github.com/apricote/hcloud-upload-image/util/contextlogger" - "github.com/apricote/hcloud-upload-image/util/control" + "github.com/apricote/hcloud-upload-image/contextlogger" + "github.com/apricote/hcloud-upload-image/control" ) // The pre-authenticated client. Set in the root command PersistentPreRun diff --git a/cmd/hcloud-image/cmd/upload.go b/cmd/hcloud-image/cmd/upload.go index 81ce5cf..f34fc1b 100644 --- a/cmd/hcloud-image/cmd/upload.go +++ b/cmd/hcloud-image/cmd/upload.go @@ -8,7 +8,7 @@ import ( "github.com/spf13/cobra" hcloud_upload_image "github.com/apricote/hcloud-upload-image" - "github.com/apricote/hcloud-upload-image/util/contextlogger" + "github.com/apricote/hcloud-upload-image/contextlogger" ) const ( diff --git a/cmd/hcloud-image/main.go b/cmd/hcloud-image/main.go index 25af65b..b8e7011 100644 --- a/cmd/hcloud-image/main.go +++ b/cmd/hcloud-image/main.go @@ -5,7 +5,7 @@ import ( "os" "github.com/apricote/hcloud-upload-image/cmd/hcloud-image/cmd" - "github.com/apricote/hcloud-upload-image/cmd/hcloud-image/util/ui" + "github.com/apricote/hcloud-upload-image/cmd/hcloud-image/ui" ) func init() { diff --git a/cmd/hcloud-image/util/ui/slog_handler.go b/cmd/hcloud-image/ui/slog_handler.go similarity index 100% rename from cmd/hcloud-image/util/ui/slog_handler.go rename to cmd/hcloud-image/ui/slog_handler.go diff --git a/util/contextlogger/context.go b/contextlogger/context.go similarity index 100% rename from util/contextlogger/context.go rename to contextlogger/context.go diff --git a/util/contextlogger/discard.go b/contextlogger/discard.go similarity index 100% rename from util/contextlogger/discard.go rename to contextlogger/discard.go diff --git a/util/control/retry.go b/control/retry.go similarity index 95% rename from util/control/retry.go rename to control/retry.go index 4180899..61eb4dd 100644 --- a/util/control/retry.go +++ b/control/retry.go @@ -7,7 +7,7 @@ import ( "github.com/hetznercloud/hcloud-go/v2/hcloud" - "github.com/apricote/hcloud-upload-image/util/contextlogger" + "github.com/apricote/hcloud-upload-image/contextlogger" ) // From https://github.com/hetznercloud/terraform-provider-hcloud/blob/v1.46.1/internal/control/retry.go diff --git a/util/randomid/randomid.go b/randomid/randomid.go similarity index 100% rename from util/randomid/randomid.go rename to randomid/randomid.go diff --git a/util/randomid/randomid_test.go b/randomid/randomid_test.go similarity index 100% rename from util/randomid/randomid_test.go rename to randomid/randomid_test.go diff --git a/snapshot.go b/snapshot.go index 29464ee..6ff7970 100644 --- a/snapshot.go +++ b/snapshot.go @@ -8,11 +8,11 @@ import ( "github.com/hetznercloud/hcloud-go/v2/hcloud" "golang.org/x/crypto/ssh" - "github.com/apricote/hcloud-upload-image/util/contextlogger" - "github.com/apricote/hcloud-upload-image/util/control" - "github.com/apricote/hcloud-upload-image/util/randomid" - "github.com/apricote/hcloud-upload-image/util/sshkey" - "github.com/apricote/hcloud-upload-image/util/sshsession" + "github.com/apricote/hcloud-upload-image/contextlogger" + "github.com/apricote/hcloud-upload-image/control" + "github.com/apricote/hcloud-upload-image/randomid" + "github.com/apricote/hcloud-upload-image/sshkey" + "github.com/apricote/hcloud-upload-image/sshsession" ) const ( diff --git a/util/sshkey/ssh_key.go b/sshkey/ssh_key.go similarity index 100% rename from util/sshkey/ssh_key.go rename to sshkey/ssh_key.go diff --git a/util/sshkey/ssh_key_test.go b/sshkey/ssh_key_test.go similarity index 100% rename from util/sshkey/ssh_key_test.go rename to sshkey/ssh_key_test.go diff --git a/util/sshsession/session.go b/sshsession/session.go similarity index 100% rename from util/sshsession/session.go rename to sshsession/session.go