Skip to content

Commit 91e44c7

Browse files
znullCopilot
andcommitted
Fix golangci-lint issues
Address gocritic, revive, and unused-code findings in the Pipe/runner helper code. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent e25414a commit 91e44c7

3 files changed

Lines changed: 3 additions & 14 deletions

File tree

pipe/config.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@ func NewConfig(options ...ConfigOption) *Config {
3333
// plus the additional `option`.
3434
func (cfg *Config) WithOption(option ConfigOption) *Config {
3535
newCfg := newConfig(cfg.options, 1)
36-
newCfg.options = append(cfg.options, option)
36+
newCfg.options = append(newCfg.options, option)
3737
return newCfg
3838
}
3939

4040
// WithOption returns a new `Config` with the same options as `cfg`
4141
// plus the additional `options`.
4242
func (cfg *Config) WithOptions(options ...ConfigOption) *Config {
4343
newCfg := newConfig(cfg.options, len(options))
44-
newCfg.options = append(cfg.options, options...)
44+
newCfg.options = append(newCfg.options, options...)
4545
return newCfg
4646
}
4747

pipe/event_error.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@ type EventHandler func(err *EventError)
1616
func (err *EventError) Error() string {
1717
if err.Msg == "" {
1818
return fmt.Sprintf("%s: %v", err.Command, err.Err)
19-
} else {
20-
return fmt.Sprintf("%s in stage %q: %v", err.Msg, err.Command, err.Err)
2119
}
20+
return fmt.Sprintf("%s in stage %q: %v", err.Msg, err.Command, err.Err)
2221
}
2322

2423
func (err *EventError) Unwrap() error {

pipe/options.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,6 @@ type ConfigOption interface {
1313
Option
1414
}
1515

16-
// sliceConfigOption is a `ConfigOption` based on a slice of other
17-
// `ConfigOption`s.
18-
type sliceConfigOption []ConfigOption
19-
20-
func (sco sliceConfigOption) apply(r *runner) {
21-
for _, opt := range sco {
22-
opt.apply(r)
23-
}
24-
}
25-
2616
// funcConfigOption implements `ConfigOption` by calling a function.
2717
type funcConfigOption struct {
2818
fn func(r *runner)

0 commit comments

Comments
 (0)