From 03a14bb032a90e03a69b30c14ef432cef8741f33 Mon Sep 17 00:00:00 2001 From: Randy Fay Date: Sat, 10 Feb 2024 05:27:53 -0800 Subject: [PATCH] test: golangci-lint got pickier, satisfy it (#5812) --- cmd/ddev/cmd/auth-ssh.go | 2 +- cmd/ddev/cmd/auth.go | 4 ++-- cmd/ddev/cmd/commands.go | 4 ++-- cmd/ddev/cmd/composer-create.go | 4 ++-- cmd/ddev/cmd/composer.go | 4 ++-- cmd/ddev/cmd/config.go | 2 +- cmd/ddev/cmd/debug-capabilities.go | 2 +- cmd/ddev/cmd/debug-check-db-match.go | 2 +- cmd/ddev/cmd/debug-compose-config.go | 2 +- cmd/ddev/cmd/debug-config-yaml.go | 2 +- cmd/ddev/cmd/debug-dockercheck.go | 2 +- cmd/ddev/cmd/debug-download-images.go | 2 +- cmd/ddev/cmd/debug-fixcommands.go | 2 +- cmd/ddev/cmd/debug-get-volume-db-version.go | 2 +- cmd/ddev/cmd/debug-instrumentation-clean.go | 2 +- cmd/ddev/cmd/debug-instrumentation-flush.go | 2 +- cmd/ddev/cmd/debug-instrumentation.go | 2 +- cmd/ddev/cmd/debug-message-conditions.go | 2 +- cmd/ddev/cmd/debug-migrate-database.go | 2 +- cmd/ddev/cmd/debug-mutagen.go | 2 +- cmd/ddev/cmd/debug-nfsmount.go | 2 +- cmd/ddev/cmd/debug-refresh.go | 2 +- cmd/ddev/cmd/debug-router-nginx-config.go | 2 +- cmd/ddev/cmd/debug-test.go | 2 +- cmd/ddev/cmd/debug-testcleanup.go | 2 +- cmd/ddev/cmd/debug.go | 2 +- cmd/ddev/cmd/delete-images.go | 2 +- cmd/ddev/cmd/delete.go | 2 +- cmd/ddev/cmd/describe.go | 2 +- cmd/ddev/cmd/export-db.go | 2 +- cmd/ddev/cmd/hostname.go | 2 +- cmd/ddev/cmd/import-db.go | 2 +- cmd/ddev/cmd/import-files.go | 4 ++-- cmd/ddev/cmd/list.go | 2 +- cmd/ddev/cmd/logs.go | 2 +- cmd/ddev/cmd/mutagen-logs.go | 2 +- cmd/ddev/cmd/mutagen-monitor.go | 2 +- cmd/ddev/cmd/mutagen-reset.go | 2 +- cmd/ddev/cmd/mutagen.go | 2 +- cmd/ddev/cmd/poweroff.go | 2 +- cmd/ddev/cmd/pull.go | 4 ++-- cmd/ddev/cmd/push.go | 4 ++-- cmd/ddev/cmd/restart.go | 2 +- cmd/ddev/cmd/restore_snapshot.go | 2 +- cmd/ddev/cmd/root.go | 2 +- cmd/ddev/cmd/service-disable.go | 2 +- cmd/ddev/cmd/service-enable.go | 2 +- cmd/ddev/cmd/service.go | 2 +- cmd/ddev/cmd/snapshot.go | 2 +- cmd/ddev/cmd/snapshot_restore.go | 2 +- cmd/ddev/cmd/ssh.go | 2 +- cmd/ddev/cmd/start.go | 2 +- pkg/ddevapp/utils.go | 2 +- pkg/testcommon/testcommon.go | 2 +- pkg/util/network.go | 2 +- 55 files changed, 62 insertions(+), 62 deletions(-) diff --git a/cmd/ddev/cmd/auth-ssh.go b/cmd/ddev/cmd/auth-ssh.go index a21a6d47c94..89192bf68e3 100644 --- a/cmd/ddev/cmd/auth-ssh.go +++ b/cmd/ddev/cmd/auth-ssh.go @@ -22,7 +22,7 @@ var AuthSSHCommand = &cobra.Command{ Short: "Add SSH key authentication to the ddev-ssh-auth container", Long: `Use this command to provide the password to your SSH key to the ddev-ssh-agent container, where it can be used by other containers. Normal usage is "ddev auth ssh", or if your key is not in ~/.ssh, ddev auth ssh --ssh-key-path=/some/path/.ssh"`, Example: `ddev auth ssh`, - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, args []string) { var err error if len(args) > 0 { util.Failed("This command takes no arguments.") diff --git a/cmd/ddev/cmd/auth.go b/cmd/ddev/cmd/auth.go index a61427503be..cef9f17b2dd 100644 --- a/cmd/ddev/cmd/auth.go +++ b/cmd/ddev/cmd/auth.go @@ -11,7 +11,7 @@ var AuthCmd = &cobra.Command{ Use: "auth [command]", Short: "A collection of authentication commands", Example: `ddev auth ssh`, - Run: func(cmd *cobra.Command, args []string) { + Run: func(cmd *cobra.Command, _ []string) { err := cmd.Usage() util.CheckErr(err) }, @@ -25,7 +25,7 @@ func init() { Use: "pantheon", Short: "ddev auth pantheon is no longer needed, see docs", Hidden: true, - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { output.UserOut.Print("`ddev auth pantheon` is no longer needed, see docs") }, }) diff --git a/cmd/ddev/cmd/commands.go b/cmd/ddev/cmd/commands.go index 80bae9bdf11..9a20d8d41c0 100644 --- a/cmd/ddev/cmd/commands.go +++ b/cmd/ddev/cmd/commands.go @@ -297,7 +297,7 @@ func makeHostCmd(app *ddevapp.DdevApp, fullPath, name string) func(*cobra.Comman windowsBashPath = util.FindBashPath() } - return func(cmd *cobra.Command, cobraArgs []string) { + return func(_ *cobra.Command, _ []string) { if app != nil { status, _ := app.SiteStatus() app.DockerEnv() @@ -335,7 +335,7 @@ func makeContainerCmd(app *ddevapp.DdevApp, fullPath, name, service string, exec if s[0:1] == "." { s = s[1:] } - return func(cmd *cobra.Command, args []string) { + return func(_ *cobra.Command, _ []string) { status, _ := app.SiteStatus() if status != ddevapp.SiteRunning { err := app.Start() diff --git a/cmd/ddev/cmd/composer-create.go b/cmd/ddev/cmd/composer-create.go index 51ecbe6301b..ee6e49a24ae 100644 --- a/cmd/ddev/cmd/composer-create.go +++ b/cmd/ddev/cmd/composer-create.go @@ -36,7 +36,7 @@ ddev composer create --repository=https://repo.magento.com/ magento/project-comm ddev composer create --prefer-dist --no-interaction --no-dev psr/log `, ValidArgsFunction: getComposerCompletionFunc(true), - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { // We only want to pass all flags and args to Composer // cobra does not seem to allow direct access to everything predictably @@ -225,7 +225,7 @@ var ComposerCreateProjectCmd = &cobra.Command{ Short: "Unsupported, use `ddev composer create` instead", DisableFlagParsing: true, Hidden: true, - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { util.Failed(`'ddev composer create-project' is unsupported. Please use 'ddev composer create' for basic project creation or 'ddev ssh' into the web container and execute 'composer create-project' directly.`) diff --git a/cmd/ddev/cmd/composer.go b/cmd/ddev/cmd/composer.go index f2a5742dec4..ec6fdac72a0 100644 --- a/cmd/ddev/cmd/composer.go +++ b/cmd/ddev/cmd/composer.go @@ -24,7 +24,7 @@ ddev composer require ddev composer outdated --minor-only ddev composer create drupal/recommended-project`, ValidArgsFunction: getComposerCompletionFunc(false), - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, args []string) { app, err := ddevapp.GetActiveApp("") if err != nil { util.Failed(err.Error()) @@ -62,7 +62,7 @@ func init() { } func getComposerCompletionFunc(isCreateCommand bool) func(*cobra.Command, []string, string) ([]string, cobra.ShellCompDirective) { - return func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + return func(_ *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { app, err := ddevapp.GetActiveApp("") // If there's no active app or the app isn't running, we can't get completions from composer if err != nil { diff --git a/cmd/ddev/cmd/config.go b/cmd/ddev/cmd/config.go index e3846fb5669..6c8791cb2c7 100644 --- a/cmd/ddev/cmd/config.go +++ b/cmd/ddev/cmd/config.go @@ -315,7 +315,7 @@ func init() { Use: "pantheon", Short: "ddev config pantheon is no longer needed, see docs", Hidden: true, - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { output.UserOut.Print("`ddev config pantheon` is no longer needed, see docs") }, }) diff --git a/cmd/ddev/cmd/debug-capabilities.go b/cmd/ddev/cmd/debug-capabilities.go index ae72701c269..794a5fb1f22 100644 --- a/cmd/ddev/cmd/debug-capabilities.go +++ b/cmd/ddev/cmd/debug-capabilities.go @@ -11,7 +11,7 @@ import ( var DebugCapabilitiesCmd = &cobra.Command{ Use: "capabilities", Short: "Show capabilities of this version of DDEV", - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { capabilities := []string{ "multiple-dockerfiles", "interactive-project-selection", diff --git a/cmd/ddev/cmd/debug-check-db-match.go b/cmd/ddev/cmd/debug-check-db-match.go index 28dc67cabe3..442b1e34cc4 100644 --- a/cmd/ddev/cmd/debug-check-db-match.go +++ b/cmd/ddev/cmd/debug-check-db-match.go @@ -10,7 +10,7 @@ import ( var DebugCheckDBMatch = &cobra.Command{ Use: "check-db-match", Short: "Verify that the database in the ddev-db server matches the configured type/version", - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { app, err := ddevapp.GetActiveApp("") if err != nil { util.Failed("Can't find active project: %v", err) diff --git a/cmd/ddev/cmd/debug-compose-config.go b/cmd/ddev/cmd/debug-compose-config.go index 2c87a0797bc..4e1902a2300 100644 --- a/cmd/ddev/cmd/debug-compose-config.go +++ b/cmd/ddev/cmd/debug-compose-config.go @@ -16,7 +16,7 @@ var DebugComposeConfigCmd = &cobra.Command{ ValidArgsFunction: ddevapp.GetProjectNamesFunc("all", 1), Use: "compose-config [project]", Short: "Prints the docker-compose configuration of the current project", - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, args []string) { projectName := "" if len(args) > 1 { diff --git a/cmd/ddev/cmd/debug-config-yaml.go b/cmd/ddev/cmd/debug-config-yaml.go index 1b4aff5cd36..6ba81c6c870 100644 --- a/cmd/ddev/cmd/debug-config-yaml.go +++ b/cmd/ddev/cmd/debug-config-yaml.go @@ -16,7 +16,7 @@ var DebugConfigYamlCmd = &cobra.Command{ Use: "configyaml [project]", Short: "Prints the project config.*.yaml usage", Example: "ddev debug configyaml, ddev debug configyaml ", - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, args []string) { projectName := "" if len(args) > 1 { diff --git a/cmd/ddev/cmd/debug-dockercheck.go b/cmd/ddev/cmd/debug-dockercheck.go index d58e8c2c7f6..bed1b328f7c 100644 --- a/cmd/ddev/cmd/debug-dockercheck.go +++ b/cmd/ddev/cmd/debug-dockercheck.go @@ -19,7 +19,7 @@ var DebugDockercheckCmd = &cobra.Command{ Use: "dockercheck", Short: "Diagnose DDEV Docker/Colima setup", Example: "ddev debug dockercheck", - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, args []string) { if len(args) != 0 { util.Failed("This command takes no additional arguments") } diff --git a/cmd/ddev/cmd/debug-download-images.go b/cmd/ddev/cmd/debug-download-images.go index 9abfc210e00..0a33333a5be 100644 --- a/cmd/ddev/cmd/debug-download-images.go +++ b/cmd/ddev/cmd/debug-download-images.go @@ -16,7 +16,7 @@ var DebugDownloadImagesCmd = &cobra.Command{ Use: "download-images", Short: "Download all images required by DDEV", Example: "ddev debug download-images", - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, args []string) { if len(args) != 0 { util.Failed("This command takes no additional arguments") } diff --git a/cmd/ddev/cmd/debug-fixcommands.go b/cmd/ddev/cmd/debug-fixcommands.go index b7a4188968a..29024c109da 100644 --- a/cmd/ddev/cmd/debug-fixcommands.go +++ b/cmd/ddev/cmd/debug-fixcommands.go @@ -11,7 +11,7 @@ import ( var DebugFixCommandsCmd = &cobra.Command{ Use: "fix-commands", Short: "Fix up custom/shell commands without running ddev start", - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { app, err := ddevapp.GetActiveApp("") if err != nil { util.Failed("Can't find active project: %v", err) diff --git a/cmd/ddev/cmd/debug-get-volume-db-version.go b/cmd/ddev/cmd/debug-get-volume-db-version.go index 897e41074f9..31d13c26864 100644 --- a/cmd/ddev/cmd/debug-get-volume-db-version.go +++ b/cmd/ddev/cmd/debug-get-volume-db-version.go @@ -10,7 +10,7 @@ import ( var DebugGetVolumeDBVersion = &cobra.Command{ Use: "get-volume-db-version", Short: "Get the database type/version found in the ddev-dbserver's database volume, which may not be the same as the configured database type/version", - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { app, err := ddevapp.GetActiveApp("") if err != nil { util.Failed("Can't find active project: %v", err) diff --git a/cmd/ddev/cmd/debug-instrumentation-clean.go b/cmd/ddev/cmd/debug-instrumentation-clean.go index e0654cbda92..53f61f3237c 100644 --- a/cmd/ddev/cmd/debug-instrumentation-clean.go +++ b/cmd/ddev/cmd/debug-instrumentation-clean.go @@ -10,7 +10,7 @@ import ( var DebugInstrumentationCleanCmd = &cobra.Command{ Use: "clean", Short: "Removes usage statistics from the local cache", - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { amplitude.Clean() util.Success("Usage statistics deleted.") diff --git a/cmd/ddev/cmd/debug-instrumentation-flush.go b/cmd/ddev/cmd/debug-instrumentation-flush.go index 2ce51e76478..8db6765c2d1 100644 --- a/cmd/ddev/cmd/debug-instrumentation-flush.go +++ b/cmd/ddev/cmd/debug-instrumentation-flush.go @@ -11,7 +11,7 @@ import ( var DebugInstrumentationFlushCmd = &cobra.Command{ Use: "flush", Short: "Transmits usage statistics from the local cache", - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { if amplitude.IsDisabled() { util.Warning("Instrumentation is currently disabled.") diff --git a/cmd/ddev/cmd/debug-instrumentation.go b/cmd/ddev/cmd/debug-instrumentation.go index a20700731c9..3bf318d448f 100644 --- a/cmd/ddev/cmd/debug-instrumentation.go +++ b/cmd/ddev/cmd/debug-instrumentation.go @@ -9,7 +9,7 @@ import ( var DebugInstrumentationCmd = &cobra.Command{ Use: "instrumentation [command]", Short: "A collection of debugging commands for instrumentation", - Run: func(cmd *cobra.Command, args []string) { + Run: func(cmd *cobra.Command, _ []string) { err := cmd.Usage() util.CheckErr(err) }, diff --git a/cmd/ddev/cmd/debug-message-conditions.go b/cmd/ddev/cmd/debug-message-conditions.go index a770f603f2b..db3835b913c 100644 --- a/cmd/ddev/cmd/debug-message-conditions.go +++ b/cmd/ddev/cmd/debug-message-conditions.go @@ -12,7 +12,7 @@ import ( var DebugMessageConditionsCmd = &cobra.Command{ Use: "message-conditions", Short: "Show message conditions of this version of ddev", - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { conditions := remoteconfig.ListConditions() t := table.NewWriter() diff --git a/cmd/ddev/cmd/debug-migrate-database.go b/cmd/ddev/cmd/debug-migrate-database.go index 0d06eca4df8..95d213c1e43 100644 --- a/cmd/ddev/cmd/debug-migrate-database.go +++ b/cmd/ddev/cmd/debug-migrate-database.go @@ -17,7 +17,7 @@ var DebugMigrateDatabase = &cobra.Command{ Example: `ddev debug migrate-database mysql:8.0 ddev debug migrate-database mariadb:10.7`, Args: cobra.ExactArgs(1), - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, args []string) { app, err := ddevapp.GetActiveApp("") if err != nil { util.Failed("Can't find active project: %v", err) diff --git a/cmd/ddev/cmd/debug-mutagen.go b/cmd/ddev/cmd/debug-mutagen.go index b2cebbc03e4..e1287ba68f4 100644 --- a/cmd/ddev/cmd/debug-mutagen.go +++ b/cmd/ddev/cmd/debug-mutagen.go @@ -23,7 +23,7 @@ ddev debug mutagen daemon stop ddev debug mutagen ddev d mutagen sync list `, - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, args []string) { mutagenPath := globalconfig.GetMutagenPath() _, err := os.Stat(mutagenPath) if err != nil { diff --git a/cmd/ddev/cmd/debug-nfsmount.go b/cmd/ddev/cmd/debug-nfsmount.go index b289b0186f7..41a10ceb710 100644 --- a/cmd/ddev/cmd/debug-nfsmount.go +++ b/cmd/ddev/cmd/debug-nfsmount.go @@ -22,7 +22,7 @@ var DebugNFSMountCmd = &cobra.Command{ Use: "nfsmount", Short: "Checks to see if nfs mounting works for current project", Example: "ddev debug nfsmount", - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, args []string) { testVolume := "testnfsmount" containerName := "testnfscontainer" diff --git a/cmd/ddev/cmd/debug-refresh.go b/cmd/ddev/cmd/debug-refresh.go index c0d569cef27..e1657c36764 100644 --- a/cmd/ddev/cmd/debug-refresh.go +++ b/cmd/ddev/cmd/debug-refresh.go @@ -15,7 +15,7 @@ var DebugRefreshCmd = &cobra.Command{ ValidArgsFunction: ddevapp.GetProjectNamesFunc("all", 1), Use: "refresh", Short: "Refreshes Docker cache for project", - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, args []string) { projectName := "" if len(args) > 1 { diff --git a/cmd/ddev/cmd/debug-router-nginx-config.go b/cmd/ddev/cmd/debug-router-nginx-config.go index 944042cadc8..305c1538e66 100644 --- a/cmd/ddev/cmd/debug-router-nginx-config.go +++ b/cmd/ddev/cmd/debug-router-nginx-config.go @@ -22,7 +22,7 @@ var DebugRouterNginxConfigCmd = &cobra.Command{ Use: "nginx-proxy-router-nginx-config", Short: "Obsolete: Prints the nginx config in the legacy `nginx-proxy` router", Example: "ddev debug nginx-proxy-router-nginx-config", - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { app, err := ddevapp.GetActiveApp("") if err != nil { util.Failed("Failed to debug router-config : %v", err) diff --git a/cmd/ddev/cmd/debug-test.go b/cmd/ddev/cmd/debug-test.go index 17c80dc5373..dc0ff0f7076 100644 --- a/cmd/ddev/cmd/debug-test.go +++ b/cmd/ddev/cmd/debug-test.go @@ -16,7 +16,7 @@ var DebugTestCmdCmd = &cobra.Command{ Use: "test", Short: "Run diagnostics on DDEV using the embedded test_ddev.sh script", Example: "ddev debug test", - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, args []string) { if len(args) != 0 { util.Failed("This command takes no additional arguments") } diff --git a/cmd/ddev/cmd/debug-testcleanup.go b/cmd/ddev/cmd/debug-testcleanup.go index e66a6bdd74c..b1fd3c856bf 100644 --- a/cmd/ddev/cmd/debug-testcleanup.go +++ b/cmd/ddev/cmd/debug-testcleanup.go @@ -13,7 +13,7 @@ var DebugTestCleanupCmd = &cobra.Command{ Use: "testcleanup", Short: "Removes diagnostic projects prefixed with 'tryddevproject-'", Example: "ddev debug testcleanup", - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, args []string) { if len(args) != 0 { util.Failed("This command takes no additional arguments") } diff --git a/cmd/ddev/cmd/debug.go b/cmd/ddev/cmd/debug.go index 2c974f1aed4..e234c4a015c 100644 --- a/cmd/ddev/cmd/debug.go +++ b/cmd/ddev/cmd/debug.go @@ -14,7 +14,7 @@ var DebugCmd = &cobra.Command{ ddev debug mutagen sync list ddev d mutagen sync list ddev d capabilities`, - Run: func(cmd *cobra.Command, args []string) { + Run: func(cmd *cobra.Command, _ []string) { err := cmd.Usage() util.CheckErr(err) }, diff --git a/cmd/ddev/cmd/delete-images.go b/cmd/ddev/cmd/delete-images.go index 03836efdde2..8facb5433f9 100644 --- a/cmd/ddev/cmd/delete-images.go +++ b/cmd/ddev/cmd/delete-images.go @@ -25,7 +25,7 @@ ddev delete images -y ddev delete images --all`, Args: cobra.NoArgs, - Run: func(cmd *cobra.Command, args []string) { + Run: func(cmd *cobra.Command, _ []string) { // If true, --yes, we don't stop and prompt before deletion deleteImagesNocConfirm, _ := cmd.Flags().GetBool("yes") diff --git a/cmd/ddev/cmd/delete.go b/cmd/ddev/cmd/delete.go index 25bb696310d..25d6e0b4d4b 100644 --- a/cmd/ddev/cmd/delete.go +++ b/cmd/ddev/cmd/delete.go @@ -26,7 +26,7 @@ ddev delete --omit-snapshot proj1 ddev delete --omit-snapshot --yes proj1 proj2 ddev delete -Oy ddev delete --all`, - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, args []string) { if noConfirm && deleteAll { util.Failed("Sorry, it's not possible to use flags --all and --yes together") } diff --git a/cmd/ddev/cmd/describe.go b/cmd/ddev/cmd/describe.go index 88c9bbad1d6..cc1ab6c0331 100644 --- a/cmd/ddev/cmd/describe.go +++ b/cmd/ddev/cmd/describe.go @@ -32,7 +32,7 @@ additional services like Mailpit. You can run 'ddev describe' from a project directory to describe that project, or you can specify a project to describe by running 'ddev describe '.`, Example: "ddev describe\nddev describe \nddev status\nddev st", - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, args []string) { if len(args) > 1 { util.Failed("Too many arguments provided. Please use 'ddev describe' or 'ddev describe [projectname]'") } diff --git a/cmd/ddev/cmd/export-db.go b/cmd/ddev/cmd/export-db.go index 9e2aeb3e23c..cf9fe46530e 100644 --- a/cmd/ddev/cmd/export-db.go +++ b/cmd/ddev/cmd/export-db.go @@ -25,7 +25,7 @@ func NewExportDBCmd() *cobra.Command { $ ddev export-db my-project --gzip=false --file=/tmp/my_project.sql `), Args: cobra.RangeArgs(0, 1), - PreRun: func(cmd *cobra.Command, args []string) { + PreRun: func(_ *cobra.Command, _ []string) { dockerutil.EnsureDdevNetwork() }, RunE: func(cmd *cobra.Command, args []string) error { diff --git a/cmd/ddev/cmd/hostname.go b/cmd/ddev/cmd/hostname.go index 421edbeefbe..495711c2671 100644 --- a/cmd/ddev/cmd/hostname.go +++ b/cmd/ddev/cmd/hostname.go @@ -26,7 +26,7 @@ ddev hostname --remove-inactive Long: `Manage your hostfile entries. Managing host names has security and usability implications and requires elevated privileges. You may be asked for a password to allow DDEV to modify your hosts file. If you are connected to the internet and using the domain ddev.site this is generally not necessary, because the hosts file never gets manipulated.`, - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, args []string) { // Unless DDEV_NONINTERACTIVE is set (tests) then we need to be admin if os.Getenv("DDEV_NONINTERACTIVE") == "" && os.Geteuid() != 0 && !checkHostnameFlag && !removeInactiveFlag && runtime.GOOS != "windows" { diff --git a/cmd/ddev/cmd/import-db.go b/cmd/ddev/cmd/import-db.go index 40d30fab9bf..e331e540c05 100644 --- a/cmd/ddev/cmd/import-db.go +++ b/cmd/ddev/cmd/import-db.go @@ -42,7 +42,7 @@ func NewImportDBCmd() *cobra.Command { $ ddev import-db my-project < db.sql $ gzip -dc db.sql.gz | ddev import-db `), - PreRun: func(cmd *cobra.Command, args []string) { + PreRun: func(_ *cobra.Command, _ []string) { dockerutil.EnsureDdevNetwork() }, RunE: func(cmd *cobra.Command, args []string) error { diff --git a/cmd/ddev/cmd/import-files.go b/cmd/ddev/cmd/import-files.go index 5b1547905b8..ea45b256cf8 100644 --- a/cmd/ddev/cmd/import-files.go +++ b/cmd/ddev/cmd/import-files.go @@ -40,11 +40,11 @@ func NewImportFileCmd() *cobra.Command { ddev import-files --source=.tarballs/files.tar.xz --target=../private ddev import-files --source=.tarballs/files.tar.gz --target=sites/default/files `), - PreRun: func(cmd *cobra.Command, args []string) { + PreRun: func(_ *cobra.Command, _ []string) { dockerutil.EnsureDdevNetwork() }, Args: cobra.ExactArgs(0), - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *cobra.Command, _ []string) error { app, err := ddevapp.GetActiveApp("") if err != nil { return fmt.Errorf("unable to get project: %v", err) diff --git a/cmd/ddev/cmd/list.go b/cmd/ddev/cmd/list.go index 1c6604a6621..6a81f7c3521 100644 --- a/cmd/ddev/cmd/list.go +++ b/cmd/ddev/cmd/list.go @@ -18,7 +18,7 @@ ddev list --active-only ddev list -A ddev list --type=drupal8 ddev list -t drupal8`, - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { ddevapp.List(listCommandSettings) }, } diff --git a/cmd/ddev/cmd/logs.go b/cmd/ddev/cmd/logs.go index 4efce9b2108..cf921d1f78b 100644 --- a/cmd/ddev/cmd/logs.go +++ b/cmd/ddev/cmd/logs.go @@ -22,7 +22,7 @@ var DdevLogsCmd = &cobra.Command{ ddev logs -f ddev logs -s db ddev logs -s db [projectname]`, - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, args []string) { if len(args) > 1 { util.Failed("Too many arguments provided. Please use 'ddev logs' or 'ddev logs [projectname]'") } diff --git a/cmd/ddev/cmd/mutagen-logs.go b/cmd/ddev/cmd/mutagen-logs.go index 7e8b4281b3f..0db0bad1ffb 100644 --- a/cmd/ddev/cmd/mutagen-logs.go +++ b/cmd/ddev/cmd/mutagen-logs.go @@ -16,7 +16,7 @@ var MutagenLogsCmd = &cobra.Command{ Use: "logs", Short: "Show Mutagen logs for debugging", Example: `"ddev mutagen logs"`, - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { ddevapp.StopMutagenDaemon() _ = os.Setenv("MUTAGEN_LOG_LEVEL", "trace") diff --git a/cmd/ddev/cmd/mutagen-monitor.go b/cmd/ddev/cmd/mutagen-monitor.go index a7f6fb76019..761dda33503 100644 --- a/cmd/ddev/cmd/mutagen-monitor.go +++ b/cmd/ddev/cmd/mutagen-monitor.go @@ -12,7 +12,7 @@ var MutagenMonitorCmd = &cobra.Command{ Use: "monitor", Short: "Monitor Mutagen status", Example: `"ddev mutagen monitor", "ddev mutagen monitor "`, - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, args []string) { projectName := "" if len(args) > 1 { util.Failed("This command only takes one optional argument: project-name") diff --git a/cmd/ddev/cmd/mutagen-reset.go b/cmd/ddev/cmd/mutagen-reset.go index df43d2cc373..ddd9e8bc7a4 100644 --- a/cmd/ddev/cmd/mutagen-reset.go +++ b/cmd/ddev/cmd/mutagen-reset.go @@ -15,7 +15,7 @@ var MutagenResetCmd = &cobra.Command{ Short: "Reset Mutagen for project", Long: "Stops project, removes the Mutagen Docker volume", Example: `"ddev mutagen reset", "ddev mutagen reset "`, - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, args []string) { projectName := "" if len(args) > 1 { util.Failed("This command only takes one optional argument: project-name") diff --git a/cmd/ddev/cmd/mutagen.go b/cmd/ddev/cmd/mutagen.go index 2441518552d..a5a7fa7b009 100644 --- a/cmd/ddev/cmd/mutagen.go +++ b/cmd/ddev/cmd/mutagen.go @@ -9,7 +9,7 @@ import ( var MutagenCmd = &cobra.Command{ Use: "mutagen [command]", Short: "Commands for Mutagen status and sync, etc.", - Run: func(cmd *cobra.Command, args []string) { + Run: func(cmd *cobra.Command, _ []string) { err := cmd.Usage() util.CheckErr(err) }, diff --git a/cmd/ddev/cmd/poweroff.go b/cmd/ddev/cmd/poweroff.go index 5b803d6337b..18e5306d569 100644 --- a/cmd/ddev/cmd/poweroff.go +++ b/cmd/ddev/cmd/poweroff.go @@ -13,7 +13,7 @@ var PoweroffCommand = &cobra.Command{ Example: `ddev poweroff`, Args: cobra.NoArgs, Aliases: []string{"powerdown"}, - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { ddevapp.PowerOff() }, } diff --git a/cmd/ddev/cmd/pull.go b/cmd/ddev/cmd/pull.go index 83a843f3149..07093d4ffbd 100644 --- a/cmd/ddev/cmd/pull.go +++ b/cmd/ddev/cmd/pull.go @@ -28,7 +28,7 @@ ddev pull platform --environment=PLATFORM_ENVIRONMENT=main,PLATFORMSH_CLI_TOKEN= `, Args: cobra.ExactArgs(1), - PreRun: func(cmd *cobra.Command, args []string) { + PreRun: func(_ *cobra.Command, _ []string) { dockerutil.EnsureDdevNetwork() }, } @@ -101,7 +101,7 @@ func init() { ddev pull %s -y ddev pull %s --skip-files -y`, subCommandName, subCommandName, subCommandName), Args: cobra.ExactArgs(0), - Run: func(cmd *cobra.Command, args []string) { + Run: func(cmd *cobra.Command, _ []string) { app, err := ddevapp.GetActiveApp("") if err != nil { util.Failed("Pull failed: %v", err) diff --git a/cmd/ddev/cmd/push.go b/cmd/ddev/cmd/push.go index b782ccf06de..8b7619528b4 100644 --- a/cmd/ddev/cmd/push.go +++ b/cmd/ddev/cmd/push.go @@ -26,7 +26,7 @@ ddev push acquia --skip-db -y ddev push platform --environment=PLATFORM_ENVIRONMENT=main,PLATFORMSH_CLI_TOKEN=abcdef `, Args: cobra.ExactArgs(1), - PreRun: func(cmd *cobra.Command, args []string) { + PreRun: func(_ *cobra.Command, _ []string) { dockerutil.EnsureDdevNetwork() }, } @@ -99,7 +99,7 @@ func init() { ddev push %s -y ddev push %s --skip-files -y`, subCommandName, subCommandName, subCommandName), Args: cobra.ExactArgs(0), - Run: func(cmd *cobra.Command, args []string) { + Run: func(cmd *cobra.Command, _ []string) { app, err := ddevapp.GetActiveApp("") if err != nil { util.Failed("push failed: %v", err) diff --git a/cmd/ddev/cmd/restart.go b/cmd/ddev/cmd/restart.go index 25387f49a01..bbcfad28eeb 100644 --- a/cmd/ddev/cmd/restart.go +++ b/cmd/ddev/cmd/restart.go @@ -23,7 +23,7 @@ var RestartCmd = &cobra.Command{ Example: `ddev restart ddev restart ddev restart --all`, - PreRun: func(cmd *cobra.Command, args []string) { + PreRun: func(_ *cobra.Command, _ []string) { dockerutil.EnsureDdevNetwork() }, Run: func(cmd *cobra.Command, args []string) { diff --git a/cmd/ddev/cmd/restore_snapshot.go b/cmd/ddev/cmd/restore_snapshot.go index 50109c314b3..6201bbe0542 100644 --- a/cmd/ddev/cmd/restore_snapshot.go +++ b/cmd/ddev/cmd/restore_snapshot.go @@ -12,7 +12,7 @@ var DdevRestoreSnapshotCommand = &cobra.Command{ Use: "restore-snapshot [snapshot_name]", Short: "Restore a project's database to the provided snapshot version.", Long: "Please use \"snapshot restore\" command", - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { util.Failed("Please use \"ddev snapshot restore\".") os.Exit(1) }, diff --git a/cmd/ddev/cmd/root.go b/cmd/ddev/cmd/root.go index 370fe033d33..9895af6f27f 100644 --- a/cmd/ddev/cmd/root.go +++ b/cmd/ddev/cmd/root.go @@ -100,7 +100,7 @@ Support: https://ddev.readthedocs.io/en/stable/users/support`, } } }, - PersistentPostRun: func(cmd *cobra.Command, args []string) { + PersistentPostRun: func(cmd *cobra.Command, _ []string) { if instrumentationApp == nil { app, err := ddevapp.GetActiveApp("") if err == nil { diff --git a/cmd/ddev/cmd/service-disable.go b/cmd/ddev/cmd/service-disable.go index bcadbd9ea6f..d282deb8df0 100644 --- a/cmd/ddev/cmd/service-disable.go +++ b/cmd/ddev/cmd/service-disable.go @@ -15,7 +15,7 @@ var ServiceDisable = &cobra.Command{ Short: "disable a 3rd party service", Long: fmt.Sprintf(`disable a 3rd party service. The docker-compose.*.yaml will be moved from .ddev into .ddev/%s.`, disabledServicesDir), Example: `ddev service disable solr`, - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, args []string) { if len(args) < 1 { util.Failed("You must specify a service to disable") } diff --git a/cmd/ddev/cmd/service-enable.go b/cmd/ddev/cmd/service-enable.go index ded1cfd579b..7ee88f9901a 100644 --- a/cmd/ddev/cmd/service-enable.go +++ b/cmd/ddev/cmd/service-enable.go @@ -15,7 +15,7 @@ var ServiceEnable = &cobra.Command{ Short: "Enable a 3rd party service", Long: fmt.Sprintf(`Enable a 3rd party service. The service must exist as .ddev/%s/docker-compose..yaml. Note that you can use "ddev get" to obtain a service not already on your system.`, disabledServicesDir), Example: `ddev service enable solr`, - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, args []string) { if len(args) < 1 { util.Failed("You must specify a service to enable") } diff --git a/cmd/ddev/cmd/service.go b/cmd/ddev/cmd/service.go index a3ad68d72bb..96ad6abce6c 100644 --- a/cmd/ddev/cmd/service.go +++ b/cmd/ddev/cmd/service.go @@ -9,7 +9,7 @@ import ( var ServiceCmd = &cobra.Command{ Use: "service [command]", Short: "Add or remove, enable or disable extra services", - Run: func(cmd *cobra.Command, args []string) { + Run: func(cmd *cobra.Command, _ []string) { err := cmd.Usage() util.CheckErr(err) }, diff --git a/cmd/ddev/cmd/snapshot.go b/cmd/ddev/cmd/snapshot.go index fabb795012b..94abe615974 100644 --- a/cmd/ddev/cmd/snapshot.go +++ b/cmd/ddev/cmd/snapshot.go @@ -31,7 +31,7 @@ ddev snapshot --cleanup ddev snapshot --cleanup -y ddev snapshot --list ddev snapshot --all`, - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, args []string) { apps, err := getRequestedProjects(args, snapshotAll) if err != nil { util.Failed("Unable to get project(s) %v: %v", args, err) diff --git a/cmd/ddev/cmd/snapshot_restore.go b/cmd/ddev/cmd/snapshot_restore.go index 52b735871ee..ecfd95b746e 100644 --- a/cmd/ddev/cmd/snapshot_restore.go +++ b/cmd/ddev/cmd/snapshot_restore.go @@ -14,7 +14,7 @@ var DdevSnapshotRestoreCommand = &cobra.Command{ Short: "Restore a project's database to the provided snapshot version.", Long: `Uses mariabackup command to restore a project database to a particular snapshot from the .ddev/db_snapshots folder. Example: "ddev snapshot restore d8git_20180717203845"`, - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, args []string) { var snapshotName string app, err := ddevapp.GetActiveApp("") diff --git a/cmd/ddev/cmd/ssh.go b/cmd/ddev/cmd/ssh.go index 664bd6c3d2b..55ea40ce0c6 100644 --- a/cmd/ddev/cmd/ssh.go +++ b/cmd/ddev/cmd/ssh.go @@ -24,7 +24,7 @@ ddev ssh -s db ddev ssh ddev ssh -d /var/www/html`, Args: cobra.MaximumNArgs(1), - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, args []string) { projects, err := getRequestedProjects(args, false) if err != nil || len(projects) == 0 { util.Failed("Failed to ddev ssh: %v", err) diff --git a/cmd/ddev/cmd/start.go b/cmd/ddev/cmd/start.go index b28020c7fb2..7f723a8db7f 100644 --- a/cmd/ddev/cmd/start.go +++ b/cmd/ddev/cmd/start.go @@ -34,7 +34,7 @@ any directory by running 'ddev start projectname [projectname ...]'`, Example: `ddev start ddev start ddev start --all`, - PreRun: func(cmd *cobra.Command, args []string) { + PreRun: func(_ *cobra.Command, _ []string) { dockerutil.EnsureDdevNetwork() }, Run: func(cmd *cobra.Command, args []string) { diff --git a/pkg/ddevapp/utils.go b/pkg/ddevapp/utils.go index 5d494d5732c..8b13781f9a1 100644 --- a/pkg/ddevapp/utils.go +++ b/pkg/ddevapp/utils.go @@ -427,7 +427,7 @@ func ExtractProjectNames(apps []*DdevApp) []string { // If numArgs is 0, completion will be provided for infinite arguments, // otherwise it will only be provided for the numArgs number of arguments. func GetProjectNamesFunc(status string, numArgs int) func(*cobra.Command, []string, string) ([]string, cobra.ShellCompDirective) { - return func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + return func(_ *cobra.Command, args []string, _ string) ([]string, cobra.ShellCompDirective) { // Don't provide completions if the user keeps hitting space after // exhausting all of the valid arguments. if numArgs > 0 && len(args)+1 > numArgs { diff --git a/pkg/testcommon/testcommon.go b/pkg/testcommon/testcommon.go index 1815eb9cb2c..17eee5bcc28 100644 --- a/pkg/testcommon/testcommon.go +++ b/pkg/testcommon/testcommon.go @@ -373,7 +373,7 @@ func GetLocalHTTPResponse(t *testing.T, rawurl string, timeoutSecsAry ...int) (s // Do not follow redirects, https://stackoverflow.com/a/38150816/215713 client := &http.Client{ - CheckRedirect: func(req *http.Request, via []*http.Request) error { + CheckRedirect: func(_ *http.Request, _ []*http.Request) error { return http.ErrUseLastResponse }, Transport: transport, diff --git a/pkg/util/network.go b/pkg/util/network.go index c72bec9a49e..88dc9455f5c 100644 --- a/pkg/util/network.go +++ b/pkg/util/network.go @@ -88,7 +88,7 @@ func EnsureHTTPStatus(o *HTTPOptions) error { client := &http.Client{ Timeout: o.Timeout * time.Second, } - client.CheckRedirect = func(req *http.Request, via []*http.Request) error { + client.CheckRedirect = func(_ *http.Request, _ []*http.Request) error { return errors.New("received http redirect") }