From bb459941baf36296eaf5c05a72781dfd16992dee Mon Sep 17 00:00:00 2001 From: unclegedd Date: Tue, 20 Feb 2024 11:12:45 -0600 Subject: [PATCH] address linter and adds comments --- src/cmd/root.go | 4 ++-- src/cmd/uds.go | 6 +++--- src/pkg/bundler/pusher/remote.go | 4 +++- src/test/e2e/bundle_test.go | 2 ++ 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/cmd/root.go b/src/cmd/root.go index 576769ac..55faf571 100644 --- a/src/cmd/root.go +++ b/src/cmd/root.go @@ -31,7 +31,7 @@ var ( var rootCmd = &cobra.Command{ Use: "uds COMMAND", - PersistentPreRun: func(cmd *cobra.Command, args []string) { + PersistentPreRun: func(cmd *cobra.Command, _ []string) { // Skip for vendor-only commands if common.CheckVendorOnlyFromPath(cmd) { return @@ -46,7 +46,7 @@ var rootCmd = &cobra.Command{ cliSetup() }, Short: lang.RootCmdShort, - Run: func(cmd *cobra.Command, args []string) { + Run: func(cmd *cobra.Command, _ []string) { _, _ = fmt.Fprintln(os.Stderr) err := cmd.Help() if err != nil { diff --git a/src/cmd/uds.go b/src/cmd/uds.go index ff0b6955..b55b16db 100644 --- a/src/cmd/uds.go +++ b/src/cmd/uds.go @@ -26,7 +26,7 @@ var createCmd = &cobra.Command{ Aliases: []string{"c"}, Args: cobra.MaximumNArgs(1), Short: lang.CmdBundleCreateShort, - PreRun: func(cmd *cobra.Command, args []string) { + PreRun: func(_ *cobra.Command, args []string) { pathToBundleFile := "" if len(args) > 0 { if !zarfUtils.IsDir(args[0]) { @@ -44,7 +44,7 @@ var createCmd = &cobra.Command{ message.Fatalf(err, "Neither %s or %s found", config.BundleYAML, bundleYml) } }, - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, args []string) { srcDir, err := os.Getwd() if err != nil { message.Fatalf(err, "error reading the current working directory") @@ -69,7 +69,7 @@ var deployCmd = &cobra.Command{ Aliases: []string{"d"}, Short: lang.CmdBundleDeployShort, Args: cobra.MaximumNArgs(1), - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, args []string) { bundleCfg.DeployOpts.Source = chooseBundle(args) configureZarf() diff --git a/src/pkg/bundler/pusher/remote.go b/src/pkg/bundler/pusher/remote.go index 37cae6cb..9abca0df 100644 --- a/src/pkg/bundler/pusher/remote.go +++ b/src/pkg/bundler/pusher/remote.go @@ -1,6 +1,7 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-FileCopyrightText: 2023-Present The UDS Authors +// Package pusher contains functionality to push Zarf pkgs to remote bundles package pusher import ( @@ -23,6 +24,7 @@ type RemotePusher struct { cfg Config } +// Config contains the configuration for the remote pusher type Config struct { PkgRootManifest *oci.ZarfOCIManifest RemoteSrc *oci.OrasRemote @@ -81,7 +83,7 @@ func (p *RemotePusher) PushManifest() (ocispec.Descriptor, error) { return zarfManifestDesc, nil } -// todo: what does this fn return? +// LayersToRemoteBundle pushes the Zarf pkg's layers to a remote bundle func (p *RemotePusher) LayersToRemoteBundle(spinner *message.Spinner, currentPackageIter int, totalPackages int) ([]ocispec.Descriptor, error) { spinner.Updatef("Fetching %s package layer metadata (package %d of %d)", p.pkg.Name, currentPackageIter, totalPackages) // get only the layers that are required by the components diff --git a/src/test/e2e/bundle_test.go b/src/test/e2e/bundle_test.go index 2d6f30f9..d89ed309 100644 --- a/src/test/e2e/bundle_test.go +++ b/src/test/e2e/bundle_test.go @@ -528,6 +528,8 @@ func TestBundleTmpDir(t *testing.T) { done := make(chan bool) // Channel to receive errors errCh := make(chan error) + + // Watch for file creation in the temporary directory go func() { for { select {