From 48b2ed6d2a60b8e844e75d7a238f9ef868238dae Mon Sep 17 00:00:00 2001 From: Sascha Schwarze Date: Sun, 5 Jan 2025 09:13:52 +0100 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Matthias Diester Signed-off-by: Sascha Schwarze --- cmd/bundle/main.go | 2 +- cmd/git/main.go | 2 +- pkg/git/git.go | 2 +- pkg/image/endpoint.go | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/bundle/main.go b/cmd/bundle/main.go index a4a4d0c15..e0f0a4440 100644 --- a/cmd/bundle/main.go +++ b/cmd/bundle/main.go @@ -73,7 +73,7 @@ func Do(ctx context.Context) error { return fmt.Errorf("mandatory flag --image is not set") } - // sanity-check the endpoint, if hostname extraction fails, ignore that failure + // check the endpoint, if hostname extraction fails, ignore that failure if hostname, port, err := image.ExtractHostnamePort(flagValues.image); err == nil { if !util.TestConnection(hostname, port, 9) { log.Printf("Warning: a connection test to %s:%d failed. The operation will likely fail.\n", hostname, port) diff --git a/cmd/git/main.go b/cmd/git/main.go index 7efbf08b5..75195d339 100644 --- a/cmd/git/main.go +++ b/cmd/git/main.go @@ -164,7 +164,7 @@ func runGitClone(ctx context.Context) error { return &ExitError{Code: 101, Message: "the 'target' argument must not be empty"} } - // sanity-check the endpoint, if hostname extraction fails, ignore that failure + // check the endpoint, if hostname extraction fails, ignore that failure if hostname, port, err := shpgit.ExtractHostnamePort(flagValues.url); err == nil { if !util.TestConnection(hostname, port, 9) { log.Printf("Warning: a connection test to %s:%d failed. The operation will likely fail.\n", hostname, port) diff --git a/pkg/git/git.go b/pkg/git/git.go index 9f2dc3521..2afd2773f 100644 --- a/pkg/git/git.go +++ b/pkg/git/git.go @@ -43,7 +43,7 @@ func ExtractHostnamePort(url string) (string, int, error) { port = 22 default: - return "", 0, fmt.Errorf("Unknown protocol: %s", endpoint.Protocol) + return "", 0, fmt.Errorf("unknown protocol: %s", endpoint.Protocol) } } diff --git a/pkg/image/endpoint.go b/pkg/image/endpoint.go index b5a63b5b9..c6348f418 100644 --- a/pkg/image/endpoint.go +++ b/pkg/image/endpoint.go @@ -40,7 +40,7 @@ func ExtractHostnamePort(url string) (string, int, error) { port = 443 default: - return "", 0, fmt.Errorf("Unknown protocol: %s", scheme) + return "", 0, fmt.Errorf("unknown protocol: %s", scheme) } }