Skip to content

Commit

Permalink
lint: Use '_' to name unused args
Browse files Browse the repository at this point in the history
This fixes warnings with newer golangci-lint versions.

Signed-off-by: Christophe Fergeau <[email protected]>
  • Loading branch information
cfergeau authored and praveenkumar committed May 31, 2024
1 parent 9662f33 commit 4584e47
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion cmd/admin-helper/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ var Add = &cobra.Command{
Use: "add",
Aliases: []string{"a"},
Short: "Add an entry to the hostsfile",
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(_ *cobra.Command, args []string) error {
return add(args)
},
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/admin-helper/clean.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
var Clean = &cobra.Command{
Use: "clean",
Short: "Clean all entries added with a particular suffix",
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(_ *cobra.Command, args []string) error {
return clean(args)
},
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/admin-helper/contains.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ var Contains = &cobra.Command{
Use: "contains",
Short: "Check if an ip and host are present in hosts file",
Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(_ *cobra.Command, args []string) error {
return contains(args)
},
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/admin-helper/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ var UninstallDaemon = &cobra.Command{
var Daemon = &cobra.Command{
Use: "daemon",
Short: "Run as a daemon",
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(_ *cobra.Command, _ []string) error {
return daemon()
},
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/admin-helper/remove.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ var Remove = &cobra.Command{
Use: "remove",
Aliases: []string{"rm", "r"},
Short: "Remove host(s) if exists",
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(_ *cobra.Command, args []string) error {
return remove(args)
},
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/mux.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

func Mux(hosts *hosts.Hosts) http.Handler {
mux := http.NewServeMux()
mux.HandleFunc("/version", func(w http.ResponseWriter, r *http.Request) {
mux.HandleFunc("/version", func(w http.ResponseWriter, _ *http.Request) {
_, _ = fmt.Fprint(w, constants.Version)
})
mux.HandleFunc("/add", func(w http.ResponseWriter, r *http.Request) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/hosts/hosts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ func hosts(t *testing.T, hostsFile string) Hosts {
assert.NoError(t, err)
return Hosts{
File: file,
HostFilter: func(s string) bool {
HostFilter: func(_ string) bool {
return true
},
}
Expand Down

0 comments on commit 4584e47

Please sign in to comment.