From b356237851b5d2ab7ed6c2cb33eb2a69aa4df052 Mon Sep 17 00:00:00 2001 From: Integralist Date: Wed, 19 Apr 2023 10:08:12 +0100 Subject: [PATCH 1/2] docs(compute/deploy): annotate private functions --- pkg/commands/compute/deploy.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/pkg/commands/compute/deploy.go b/pkg/commands/compute/deploy.go index 5ffc65615..42d65bf22 100644 --- a/pkg/commands/compute/deploy.go +++ b/pkg/commands/compute/deploy.go @@ -14,6 +14,10 @@ import ( "strings" "time" + "github.com/fastly/go-fastly/v8/fastly" + "github.com/kennygrant/sanitize" + "github.com/mholt/archiver/v3" + "github.com/fastly/cli/pkg/api" "github.com/fastly/cli/pkg/api/undocumented" "github.com/fastly/cli/pkg/cmd" @@ -24,9 +28,6 @@ import ( "github.com/fastly/cli/pkg/manifest" "github.com/fastly/cli/pkg/text" "github.com/fastly/cli/pkg/undo" - "github.com/fastly/go-fastly/v8/fastly" - "github.com/kennygrant/sanitize" - "github.com/mholt/archiver/v3" ) const ( @@ -202,6 +203,8 @@ func (c *DeployCommand) Exec(in io.Reader, out io.Writer) (err error) { return nil } +// validStatusCodeRange checks the status is a valid status code. +// e.g. >= 100 and <= 999 func validStatusCodeRange(status int) bool { if status >= 100 && status <= 999 { return true @@ -1255,6 +1258,8 @@ func checkingServiceAvailability( } } +// generateTimeout inserts a dynamically generated message on each tick. +// It notifies the user what's happening and how long is left on the timer. func generateTimeout(d time.Duration) string { remaining := fmt.Sprintf("timeout: %v", d.Round(time.Second)) return fmt.Sprintf(" (app is being deployed across Fastly's global network | %s)...", remaining) From 66a9ae8b1c3877f9ec654e9aece09e1a437b87e6 Mon Sep 17 00:00:00 2001 From: Integralist Date: Wed, 19 Apr 2023 10:30:05 +0100 Subject: [PATCH 2/2] fix(compute/deploy): shorten message to avoid spinner bug Bug report: https://github.com/theckman/yacspin/issues/73 --- pkg/commands/compute/deploy.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/commands/compute/deploy.go b/pkg/commands/compute/deploy.go index 42d65bf22..8ee781b43 100644 --- a/pkg/commands/compute/deploy.go +++ b/pkg/commands/compute/deploy.go @@ -1262,7 +1262,7 @@ func checkingServiceAvailability( // It notifies the user what's happening and how long is left on the timer. func generateTimeout(d time.Duration) string { remaining := fmt.Sprintf("timeout: %v", d.Round(time.Second)) - return fmt.Sprintf(" (app is being deployed across Fastly's global network | %s)...", remaining) + return fmt.Sprintf(" (app deploying across Fastly's global network | %s)...", remaining) } // pingServiceURL indicates if the service returned a non-5xx response (or