From 83f99548e7e865407158d7a2ad1c6aff63db648e Mon Sep 17 00:00:00 2001 From: Jongwoo Han Date: Wed, 4 Oct 2023 06:32:00 +0900 Subject: [PATCH 1/3] Replace deprecated command with environment file (#1421) * Replace deprecated command with environment file Signed-off-by: Jongwoo Han * Apply suggestions from code review --------- Signed-off-by: Jongwoo Han Co-authored-by: Andrew Starr-Bochicchio --- .github/workflows/release.yml | 2 +- .github/workflows/snapcraft-candidate.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0969cb1ef..a64f98b40 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -66,7 +66,7 @@ jobs: id: build run: | make _build_snap && \ - find doctl_v*.snap -print -exec echo ::set-output name=snap::{} \; + find doctl_v*.snap -exec echo "snap={}" >> "$GITHUB_OUTPUT" \; - uses: snapcore/action-publish@master env: diff --git a/.github/workflows/snapcraft-candidate.yml b/.github/workflows/snapcraft-candidate.yml index d5e67da54..fc1f3e4e9 100644 --- a/.github/workflows/snapcraft-candidate.yml +++ b/.github/workflows/snapcraft-candidate.yml @@ -26,7 +26,7 @@ jobs: id: build run: | make _build_snap && \ - find doctl_v*.snap -print -exec echo ::set-output name=snap::{} \; + find doctl_v*.snap -exec echo "snap={}" >> "$GITHUB_OUTPUT" \; - uses: snapcore/action-publish@master env: From f1b4826274a67d8eb0e4ee140dc0f647e4cf5ac3 Mon Sep 17 00:00:00 2001 From: Oleksandr Redko Date: Wed, 4 Oct 2023 16:59:20 +0300 Subject: [PATCH 2/3] Fix typos in command descriptions, comments, and tests (#1427) --- CHANGELOG.md | 2 +- commands/charm/confirm/confirm.go | 2 +- commands/databases.go | 4 ++-- commands/namespaces.go | 2 +- commands/projects.go | 4 ++-- commands/serverless.go | 2 +- commands/serverless_samples.go | 2 +- commands/ssh_test.go | 2 +- do/serverless.go | 2 +- internal/apps/builder/builder.go | 2 +- pkg/extract/extract_test.go | 8 ++++---- 11 files changed, 16 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d2e096d5b..078c4e936 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -200,7 +200,7 @@ Changelog moved to Release Notes in [Github Releases](https://github.com/digital - #222 docs: improve package manager part in readme - @xmudrii ### Fixed -- #198 Hiding public images by deault - @xmudrii +- #198 Hiding public images by default - @xmudrii - #194 Use apk's --no-cache option instead of updating and removing cache - @cspicer - #201 fix vektra/{errors,mockery} to static vendoring instead submodule - @zchee - #223 completion: fix command description typos - @xmudrii diff --git a/commands/charm/confirm/confirm.go b/commands/charm/confirm/confirm.go index 1572776f4..79dbb77a8 100644 --- a/commands/charm/confirm/confirm.go +++ b/commands/charm/confirm/confirm.go @@ -70,7 +70,7 @@ const ( PersistPromptIfNo ) -// WithPersistPrompt configures the prompt persistance behavior. +// WithPersistPrompt configures the prompt persistence behavior. func WithPersistPrompt(v PersistPrompt) Option { return func(p *Prompt) { p.persistPrompt = v diff --git a/commands/databases.go b/commands/databases.go index 0ebb59932..309021589 100644 --- a/commands/databases.go +++ b/commands/databases.go @@ -68,7 +68,7 @@ func Databases() *Command { - The date and time when the database cluster was created`+databaseListDetails, Writer, aliasOpt("g"), displayerType(&displayers.Databases{})) nodeSizeDetails := "The size of the nodes in the database cluster, e.g. `db-s-1vcpu-1gb`` for a 1 CPU, 1GB node. For a list of available size slugs, visit: https://docs.digitalocean.com/reference/api/api-reference/#tag/Databases" - nodeNumberDetails := "The number of nodes in the database cluster. Valid values are are 1-3. In addition to the primary node, up to two standby nodes may be added for high availability." + nodeNumberDetails := "The number of nodes in the database cluster. Valid values are 1-3. In addition to the primary node, up to two standby nodes may be added for high availability." cmdDatabaseCreate := CmdBuilder(cmd, RunDatabaseCreate, "create ", "Create a database cluster", `This command creates a database cluster with the specified name. There are a number of flags that customize the configuration, all of which are optional. Without any flags set, a single-node, single-CPU PostgreSQL database cluster will be created.`, Writer, @@ -547,7 +547,7 @@ Maintenance windows are hour-long blocks of time during which DigitalOcean perfo - The day of the week the maintenance window occurs - The hour in UTC when maintenance updates will be applied, in 24 hour format (e.g. "16:00") -- A boolean representing whether maintence updates are currently pending +- A boolean representing whether maintenance updates are currently pending To see a list of your databases and their IDs, run `+"`"+`doctl databases list`+"`"+`.`, Writer, aliasOpt("g"), displayerType(&displayers.DatabaseMaintenanceWindow{})) diff --git a/commands/namespaces.go b/commands/namespaces.go index f52144199..fcfa0441d 100644 --- a/commands/namespaces.go +++ b/commands/namespaces.go @@ -177,7 +177,7 @@ func RunNamespacesListRegions(c *CmdConfig) error { return nil } -// getValidRegions returns all the region values that are accepted (region slugs and datacanter slugs) +// getValidRegions returns all the region values that are accepted (region slugs and datacenter slugs) func getValidRegions() []string { vrs := make([]string, len(validRegions)*2) i := 0 diff --git a/commands/projects.go b/commands/projects.go index 9c4636b6b..a509f824b 100644 --- a/commands/projects.go +++ b/commands/projects.go @@ -54,10 +54,10 @@ Projects allow you to organize your DigitalOcean resources (like Droplets, Space } CmdBuilder(cmd, RunProjectsList, "list", "List existing projects", - "List details for for your DigitalOcean projects, including:"+projectDetails, + "List details for your DigitalOcean projects, including:"+projectDetails, Writer, aliasOpt("ls"), displayerType(&displayers.Project{})) CmdBuilder(cmd, RunProjectsGet, "get ", "Retrieve details for a specific project", - "Display the following details for an existing project specified by its ID (use `default` for to retieve your default project):"+projectDetails, + "Display the following details for an existing project specified by its ID (use `default` for to retrieve your default project):"+projectDetails, Writer, aliasOpt("g"), displayerType(&displayers.Project{})) cmdProjectsCreate := CmdBuilder(cmd, RunProjectsCreate, "create", diff --git a/commands/serverless.go b/commands/serverless.go index 22e83f535..acd15682a 100644 --- a/commands/serverless.go +++ b/commands/serverless.go @@ -119,7 +119,7 @@ With the `+"`"+`--version flag, it will show just version information about the namespace. In general, deploying new content does not remove old content although it may overwrite it. Use `+"`"+`doctl serverless undeploy`+"`"+` to effect removal. The command accepts a list of functions or packages. Functions should be listed in `+"`"+`pkgName/fnName`+"`"+` form, or `+"`"+`fnName`+"`"+` for a function not in any package. -The `+"`"+`--packages`+"`"+` flag causes arguments without slash separators to be intepreted as packages, in which case +The `+"`"+`--packages`+"`"+` flag causes arguments without slash separators to be interpreted as packages, in which case the entire packages are removed.`, Writer) AddBoolFlag(undeploy, "packages", "p", false, "interpret simple name arguments as packages") AddBoolFlag(undeploy, "triggers", "", false, "interpret all arguments as triggers") diff --git a/commands/serverless_samples.go b/commands/serverless_samples.go index 8865e1dfd..ef988856a 100644 --- a/commands/serverless_samples.go +++ b/commands/serverless_samples.go @@ -167,7 +167,7 @@ namespace Nimbella.Example.Dotnet "typescript": typescriptSample, } - // gitignores contains the contents of a "standard" .gitigore file + // gitignores contains the contents of a "standard" .gitignore file // Note that we do not attempt to list typical IDE and editor temporaries here. // It is considered best practice for developers to list these in a personal global // ignore file (`core.excludesfile` in the git config) and not in a committed .gitignore. diff --git a/commands/ssh_test.go b/commands/ssh_test.go index f72c23502..2bf4c3f8f 100644 --- a/commands/ssh_test.go +++ b/commands/ssh_test.go @@ -24,7 +24,7 @@ import ( "github.com/stretchr/testify/assert" ) -func TestSSHComand(t *testing.T) { +func TestSSHCommand(t *testing.T) { parent := &Command{ Command: &cobra.Command{ Use: "compute", diff --git a/do/serverless.go b/do/serverless.go index 9674133cb..493674fd0 100644 --- a/do/serverless.go +++ b/do/serverless.go @@ -1261,7 +1261,7 @@ func (s *serverlessService) CredentialsPath() string { return s.credsDir } -// ReadCredentials reads the current serverless credentials from the appropriate 'creds' diretory +// ReadCredentials reads the current serverless credentials from the appropriate 'creds' directory func (s *serverlessService) ReadCredentials() (ServerlessCredentials, error) { creds := ServerlessCredentials{} credsPath := filepath.Join(s.credsDir, CredentialsFile) diff --git a/internal/apps/builder/builder.go b/internal/apps/builder/builder.go index 702eaf2f8..c4b83e186 100644 --- a/internal/apps/builder/builder.go +++ b/internal/apps/builder/builder.go @@ -266,7 +266,7 @@ func (f *DefaultComponentBuilderFactory) NewComponentBuilder(cli DockerEngineCli return nil, fmt.Errorf("component %s does not exist", opts.Component) } - // NOTE(ntate); We don't provide this as a configureable argument today. + // NOTE(ntate); We don't provide this as a configurable argument today. // We always assume we want copy-on-write. Caching occurs through re-use of the built OCI image. // This may change in the future so we provide as an argument to the baseComponentBuilder. copyOnWriteSemantics := true diff --git a/pkg/extract/extract_test.go b/pkg/extract/extract_test.go index 37e12814b..d9069e76b 100644 --- a/pkg/extract/extract_test.go +++ b/pkg/extract/extract_test.go @@ -78,10 +78,10 @@ func setUpTarGz(t *testing.T, tmpDir string, files []string) string { ModTime: info.ModTime(), } err = tarWriter.WriteHeader(header) - require.NoError(t, err, "error writting header") + require.NoError(t, err, "error writing header") _, err = io.Copy(tarWriter, file) - require.NoError(t, err, "error writting tar") + require.NoError(t, err, "error writing tar") } return tarballPath @@ -116,11 +116,11 @@ func setUpZip(t *testing.T, tmpDir string, files []string) string { header.Name = f writer, err := zipWriter.CreateHeader(header) - require.NoError(t, err, "error writting zip") + require.NoError(t, err, "error writing zip") _, err = io.Copy(writer, file) - require.NoError(t, err, "error writting file to zip") + require.NoError(t, err, "error writing file to zip") } return zipPath From f7d07b32a6323863170701a3291089bc0c2b4709 Mon Sep 17 00:00:00 2001 From: Oleksandr Redko Date: Wed, 4 Oct 2023 17:26:42 +0300 Subject: [PATCH 3/3] Add missing closing response body (#1428) Co-authored-by: Andrew Starr-Bochicchio --- do/registry.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/do/registry.go b/do/registry.go index 3f967b1b7..429b398c7 100644 --- a/do/registry.go +++ b/do/registry.go @@ -364,9 +364,10 @@ func (rs *registryService) RevokeOAuthToken(token string, endpoint string) error client := http.Client{} resp, err := client.Do(req) - if resp == nil { + if err != nil { return err } + defer resp.Body.Close() if resp.StatusCode != http.StatusOK { return errors.New("error revoking token: " + http.StatusText(resp.StatusCode))