Skip to content

Commit efa1591

Browse files
committed
Remove local golangci-lint | fix linter warnings
1 parent f74dbc1 commit efa1591

File tree

8 files changed

+28
-104
lines changed

8 files changed

+28
-104
lines changed

.golangci.yml

Lines changed: 0 additions & 73 deletions
This file was deleted.

command/version/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ func init() {
2121
}
2222

2323
// Command prints out the current version of the tool
24-
func Command(c *cli.Context) error {
24+
func Command(*cli.Context) error {
2525
fmt.Printf("%s\n", step.Version())
2626
fmt.Printf("Release Date: %s\n", step.ReleaseDate())
2727
return nil

errs/errs.go

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -115,13 +115,13 @@ func TooManyArguments(ctx *cli.Context) error {
115115

116116
// InsecureArgument returns an error with the given argument requiring the
117117
// --insecure flag.
118-
func InsecureArgument(ctx *cli.Context, name string) error {
118+
func InsecureArgument(_ *cli.Context, name string) error {
119119
return fmt.Errorf("positional argument <%s> requires the '--insecure' flag", name)
120120
}
121121

122122
// FlagValueInsecure returns an error with the given flag and value requiring
123123
// the --insecure flag.
124-
func FlagValueInsecure(ctx *cli.Context, flag, value string) error {
124+
func FlagValueInsecure(_ *cli.Context, flag, value string) error {
125125
return fmt.Errorf("flag '--%s %s' requires the '--insecure' flag", flag, value)
126126
}
127127

@@ -139,7 +139,7 @@ func InvalidFlagValue(ctx *cli.Context, flag, value, options string) error {
139139
// InvalidFlagValueMsg returns an error with the given value being missing or
140140
// invalid for the given flag. Optionally it returns an error message to aid
141141
// in debugging.
142-
func InvalidFlagValueMsg(ctx *cli.Context, flag, value, msg string) error {
142+
func InvalidFlagValueMsg(_ *cli.Context, flag, value, msg string) error {
143143
var format string
144144
if value == "" {
145145
format = fmt.Sprintf("missing value for flag '--%s'", flag)
@@ -156,19 +156,19 @@ func InvalidFlagValueMsg(ctx *cli.Context, flag, value, msg string) error {
156156

157157
// IncompatibleFlag returns an error with the flag being incompatible with the
158158
// given value.
159-
func IncompatibleFlag(ctx *cli.Context, flag, value string) error {
159+
func IncompatibleFlag(_ *cli.Context, flag, value string) error {
160160
return fmt.Errorf("flag '--%s' is incompatible with '%s'", flag, value)
161161
}
162162

163163
// IncompatibleFlagWithFlag returns an error with the flag being incompatible with the
164164
// given value.
165-
func IncompatibleFlagWithFlag(ctx *cli.Context, flag, withFlag string) error {
165+
func IncompatibleFlagWithFlag(_ *cli.Context, flag, withFlag string) error {
166166
return fmt.Errorf("flag '--%s' is incompatible with '--%s'", flag, withFlag)
167167
}
168168

169169
// IncompatibleFlagValue returns an error with the flag being incompatible with the
170170
// given value.
171-
func IncompatibleFlagValue(ctx *cli.Context, flag, incompatibleWith,
171+
func IncompatibleFlagValue(_ *cli.Context, flag, incompatibleWith,
172172
incompatibleWithValue string) error {
173173
return fmt.Errorf("flag '--%s' is incompatible with flag '--%s %s'",
174174
flag, incompatibleWith, incompatibleWithValue)
@@ -185,7 +185,7 @@ func IncompatibleFlagValues(ctx *cli.Context, flag, value, incompatibleWith,
185185
// IncompatibleFlagValueWithFlagValue returns an error with the given value
186186
// being missing or invalid for the given flag. Optionally it lists the given
187187
// formatted options at the end.
188-
func IncompatibleFlagValueWithFlagValue(ctx *cli.Context, flag, value,
188+
func IncompatibleFlagValueWithFlagValue(_ *cli.Context, flag, value,
189189
withFlag, withValue, options string) error {
190190
format := fmt.Sprintf("flag '--%s %s' is incompatible with flag '--%s %s'",
191191
flag, value, withFlag, withValue)
@@ -205,29 +205,29 @@ func RequiredFlag(ctx *cli.Context, flag string) error {
205205
}
206206

207207
// RequiredWithFlag returns an error with the required flag message with another flag.
208-
func RequiredWithFlag(ctx *cli.Context, flag, required string) error {
208+
func RequiredWithFlag(_ *cli.Context, flag, required string) error {
209209
return fmt.Errorf("flag '--%s' requires the '--%s' flag", flag, required)
210210
}
211211

212212
// RequiredWithFlagValue returns an error with the required flag message.
213-
func RequiredWithFlagValue(ctx *cli.Context, flag, value, required string) error {
213+
func RequiredWithFlagValue(_ *cli.Context, flag, value, required string) error {
214214
return fmt.Errorf("'--%s %s' requires the '--%s' flag", flag, value, required)
215215
}
216216

217217
// RequiredWithProvisionerTypeFlag returns an error with the required flag message.
218-
func RequiredWithProvisionerTypeFlag(ctx *cli.Context, provisionerType, required string) error {
218+
func RequiredWithProvisionerTypeFlag(_ *cli.Context, provisionerType, required string) error {
219219
return fmt.Errorf("provisioner type '%s' requires the '--%s' flag", provisionerType, required)
220220
}
221221

222222
// RequiredInsecureFlag returns an error with the given flag requiring the
223223
// insecure flag message.
224-
func RequiredInsecureFlag(ctx *cli.Context, flag string) error {
224+
func RequiredInsecureFlag(_ *cli.Context, flag string) error {
225225
return fmt.Errorf("flag '--%s' requires the '--insecure' flag", flag)
226226
}
227227

228228
// RequiredSubtleFlag returns an error with the given flag requiring the
229229
// subtle flag message..
230-
func RequiredSubtleFlag(ctx *cli.Context, flag string) error {
230+
func RequiredSubtleFlag(_ *cli.Context, flag string) error {
231231
return fmt.Errorf("flag '--%s' requires the '--subtle' flag", flag)
232232
}
233233

@@ -239,7 +239,7 @@ func RequiredUnlessInsecureFlag(ctx *cli.Context, flag string) error {
239239

240240
// RequiredUnlessFlag returns an error with the required flag message unless
241241
// the specified flag is used.
242-
func RequiredUnlessFlag(ctx *cli.Context, flag, unlessFlag string) error {
242+
func RequiredUnlessFlag(_ *cli.Context, flag, unlessFlag string) error {
243243
return fmt.Errorf("flag '--%s' is required unless the '--%s' flag is provided", flag, unlessFlag)
244244
}
245245

@@ -250,7 +250,7 @@ func RequiredUnlessSubtleFlag(ctx *cli.Context, flag string) error {
250250
}
251251

252252
// RequiredOrFlag returns an error with a list of flags being required messages.
253-
func RequiredOrFlag(ctx *cli.Context, flags ...string) error {
253+
func RequiredOrFlag(_ *cli.Context, flags ...string) error {
254254
params := make([]string, len(flags))
255255
for i, flag := range flags {
256256
params[i] = "--" + flag
@@ -260,7 +260,7 @@ func RequiredOrFlag(ctx *cli.Context, flags ...string) error {
260260

261261
// RequiredWithOrFlag returns an error with a list of flags at least one of which
262262
// is required in conjunction with the last flag in the list.
263-
func RequiredWithOrFlag(ctx *cli.Context, withFlag string, flags ...string) error {
263+
func RequiredWithOrFlag(_ *cli.Context, withFlag string, flags ...string) error {
264264
params := make([]string, len(flags))
265265
for i := 0; i < len(flags); i++ {
266266
params[i] = "--" + flags[i]
@@ -270,25 +270,25 @@ func RequiredWithOrFlag(ctx *cli.Context, withFlag string, flags ...string) erro
270270

271271
// MinSizeFlag returns an error with a greater or equal message message for
272272
// the given flag and size.
273-
func MinSizeFlag(ctx *cli.Context, flag, size string) error {
273+
func MinSizeFlag(_ *cli.Context, flag, size string) error {
274274
return fmt.Errorf("flag '--%s' must be greater than or equal to %s", flag, size)
275275
}
276276

277277
// MinSizeInsecureFlag returns an error with a requiring --insecure flag
278278
// message with the given flag an size.
279-
func MinSizeInsecureFlag(ctx *cli.Context, flag, size string) error {
279+
func MinSizeInsecureFlag(_ *cli.Context, flag, size string) error {
280280
return fmt.Errorf("flag '--%s' requires at least %s unless '--insecure' flag is provided", flag, size)
281281
}
282282

283283
// MutuallyExclusiveFlags returns an error with mutually exclusive message for
284284
// the given flags.
285-
func MutuallyExclusiveFlags(ctx *cli.Context, flag1, flag2 string) error {
285+
func MutuallyExclusiveFlags(_ *cli.Context, flag1, flag2 string) error {
286286
return fmt.Errorf("flag '--%s' and flag '--%s' are mutually exclusive", flag1, flag2)
287287
}
288288

289289
// UnsupportedFlag returns an error with a message saying that the given flag is
290290
// not yet supported.
291-
func UnsupportedFlag(ctx *cli.Context, flag string) error {
291+
func UnsupportedFlag(_ *cli.Context, flag string) error {
292292
return fmt.Errorf("flag '--%s' is not yet supported", flag)
293293
}
294294

fileutil/write.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ func writeChunk(filename string, data []byte, hasHeaderFooter bool, header, foot
113113
}
114114
}
115115
if !hasHeaderFooter {
116-
f.WriteString(fmt.Sprintf("%s @ %s\n", header, time.Now().UTC().Format(time.RFC3339)))
116+
fmt.Fprintf(f, "%s @ %s\n", header, time.Now().UTC().Format(time.RFC3339))
117117
}
118118
f.Write(data)
119119
if !bytes.HasSuffix(data, []byte("\n")) {

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module go.step.sm/cli-utils
22

3-
go 1.18
3+
go 1.20
44

55
require (
66
github.com/chzyer/readline v1.5.1

step/context.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,7 @@ func (cs *CtxState) Init() error {
125125
if err := cs.initCurrent(); err != nil {
126126
return err
127127
}
128-
if err := cs.load(); err != nil {
129-
return err
130-
}
131-
return nil
128+
return cs.load()
132129
}
133130

134131
func (cs *CtxState) initMap() error {
@@ -333,7 +330,7 @@ func (cs *CtxState) Remove(name string) error {
333330
}
334331

335332
if err := os.WriteFile(ContextsFile(), b, 0600); err != nil {
336-
return err
333+
return fmt.Errorf("error writing file: %w", err)
337334
}
338335
return nil
339336
}
@@ -552,7 +549,7 @@ func getConfigVars(ctx *cli.Context) (err error) {
552549
}
553550

554551
if err := cs.Apply(ctx); err != nil {
555-
return err
552+
return fmt.Errorf("error applying contexts: %w", err)
556553
}
557554

558555
return nil

usage/printer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ menu:
8787
w.Write(b)
8888
}
8989

90-
func helpPreprocessor(w io.Writer, templ string, data interface{}, applyRx bool) []byte {
90+
func helpPreprocessor(_ io.Writer, templ string, data interface{}, applyRx bool) []byte {
9191
buf := new(bytes.Buffer)
9292
cli.HelpPrinterCustom(buf, templ, data, nil)
9393
//w.Write(buf.Bytes())

usage/renderer.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ func (r *Renderer) RenderNode(w io.Writer, node *md.Node, entering bool) md.Walk
366366
}
367367

368368
// RenderHeader implements blackfriday.Renderer interface.
369-
func (r *Renderer) RenderHeader(w io.Writer, ast *md.Node) {}
369+
func (r *Renderer) RenderHeader(io.Writer, *md.Node) {}
370370

371371
// RenderFooter implements blackfriday.Renderer interface.
372-
func (r *Renderer) RenderFooter(w io.Writer, ast *md.Node) {}
372+
func (r *Renderer) RenderFooter(io.Writer, *md.Node) {}

0 commit comments

Comments
 (0)