Skip to content

Commit

Permalink
test: golangci-lint got pickier, satisfy it (#5812)
Browse files Browse the repository at this point in the history
  • Loading branch information
rfay committed Feb 10, 2024
1 parent 2acaec4 commit 03a14bb
Show file tree
Hide file tree
Showing 55 changed files with 62 additions and 62 deletions.
2 changes: 1 addition & 1 deletion cmd/ddev/cmd/auth-ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down
4 changes: 2 additions & 2 deletions cmd/ddev/cmd/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
},
Expand All @@ -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")
},
})
Expand Down
4 changes: 2 additions & 2 deletions cmd/ddev/cmd/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions cmd/ddev/cmd/composer-create.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.`)
Expand Down
4 changes: 2 additions & 2 deletions cmd/ddev/cmd/composer.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ ddev composer require <package>
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())
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion cmd/ddev/cmd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
},
})
Expand Down
2 changes: 1 addition & 1 deletion cmd/ddev/cmd/debug-capabilities.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion cmd/ddev/cmd/debug-check-db-match.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion cmd/ddev/cmd/debug-compose-config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion cmd/ddev/cmd/debug-config-yaml.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 <projectname>",
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, args []string) {
projectName := ""

if len(args) > 1 {
Expand Down
2 changes: 1 addition & 1 deletion cmd/ddev/cmd/debug-dockercheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/ddev/cmd/debug-download-images.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/ddev/cmd/debug-fixcommands.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion cmd/ddev/cmd/debug-get-volume-db-version.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion cmd/ddev/cmd/debug-instrumentation-clean.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down
2 changes: 1 addition & 1 deletion cmd/ddev/cmd/debug-instrumentation-flush.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.")

Expand Down
2 changes: 1 addition & 1 deletion cmd/ddev/cmd/debug-instrumentation.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
},
Expand Down
2 changes: 1 addition & 1 deletion cmd/ddev/cmd/debug-message-conditions.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion cmd/ddev/cmd/debug-migrate-database.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion cmd/ddev/cmd/debug-mutagen.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion cmd/ddev/cmd/debug-nfsmount.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
2 changes: 1 addition & 1 deletion cmd/ddev/cmd/debug-refresh.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion cmd/ddev/cmd/debug-router-nginx-config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion cmd/ddev/cmd/debug-test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/ddev/cmd/debug-testcleanup.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/ddev/cmd/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
},
Expand Down
2 changes: 1 addition & 1 deletion cmd/ddev/cmd/delete-images.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion cmd/ddev/cmd/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/ddev/cmd/describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 <projectname>'.`,
Example: "ddev describe\nddev describe <projectname>\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]'")
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/ddev/cmd/export-db.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion cmd/ddev/cmd/hostname.go
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand Down
2 changes: 1 addition & 1 deletion cmd/ddev/cmd/import-db.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions cmd/ddev/cmd/import-files.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion cmd/ddev/cmd/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
},
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/ddev/cmd/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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]'")
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/ddev/cmd/mutagen-logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion cmd/ddev/cmd/mutagen-monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var MutagenMonitorCmd = &cobra.Command{
Use: "monitor",
Short: "Monitor Mutagen status",
Example: `"ddev mutagen monitor", "ddev mutagen monitor <projectname>"`,
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")
Expand Down
2 changes: 1 addition & 1 deletion cmd/ddev/cmd/mutagen-reset.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 <projectname>"`,
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")
Expand Down
2 changes: 1 addition & 1 deletion cmd/ddev/cmd/mutagen.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
},
Expand Down

0 comments on commit 03a14bb

Please sign in to comment.