Skip to content

Commit

Permalink
Remove ExecName method from Exec interface again (#88)
Browse files Browse the repository at this point in the history
In GH-79 [1] a new `ExecName() string` method has been added to the
`Exec` interface [2] to improve the way how `RunnerExec` [3] handles the
name of the executable file, but it turned out that this is not useful
at all and also broke the separation of concern between the `Task` and
`Runner` interfaces.
Therefore the method has been removed again.

[1]: #79
[2]: https://pkg.go.dev/github.com/svengreb/wand/pkg/task#Exec
[3]: https://pkg.go.dev/github.com/svengreb/wand/pkg/task#RunnerExec

Closes GH-87
  • Loading branch information
svengreb authored Apr 24, 2021
1 parent 72dd6a1 commit 8b30110
Show file tree
Hide file tree
Showing 9 changed files with 5 additions and 84 deletions.
7 changes: 1 addition & 6 deletions pkg/task/gofumpt/gofumpt.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,6 @@ func (t *Task) Env() map[string]string {
return t.opts.env
}

// ExecName returns the executable name.
func (t *Task) ExecName() string {
return t.opts.execName
}

// ID returns the identifier of the Go module.
func (t *Task) ID() *project.GoModuleID {
return t.opts.goModule
Expand All @@ -94,7 +89,7 @@ func (t *Task) Kind() task.Kind {

// Name returns the task name.
func (t *Task) Name() string {
return t.opts.execName
return t.opts.name
}

// Options returns the task options.
Expand Down
16 changes: 1 addition & 15 deletions pkg/task/gofumpt/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ import (
)

const (
// DefaultExecName is the default name of the module executable.
DefaultExecName = "gofumpt"

// DefaultGoModulePath is the default module import path.
DefaultGoModulePath = "mvdan.cc/gofumpt"

Expand All @@ -34,9 +31,6 @@ type Options struct {
// env is the task specific environment.
env map[string]string

// execName is the unique executable name.
execName string

// extraArgs are additional arguments passed to the command.
extraArgs []string

Expand Down Expand Up @@ -79,8 +73,7 @@ func NewOptions(opts ...Option) (*Options, error) {
}

opt := &Options{
env: make(map[string]string),
execName: DefaultExecName,
env: make(map[string]string),
goModule: &project.GoModuleID{
Path: DefaultGoModulePath,
Version: version,
Expand All @@ -101,13 +94,6 @@ func WithEnv(env map[string]string) Option {
}
}

// WithExecName sets the name of the executable.
func WithExecName(execName string) Option {
return func(o *Options) {
o.execName = execName
}
}

// WithExtraArgs sets additional arguments to pass to the command.
func WithExtraArgs(extraArgs ...string) Option {
return func(o *Options) {
Expand Down
5 changes: 0 additions & 5 deletions pkg/task/goimports/goimports.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,6 @@ func (t *Task) Env() map[string]string {
return t.opts.env
}

// ExecName returns the executable name.
func (t *Task) ExecName() string {
return t.opts.execName
}

// ID returns the identifier of the Go module.
func (t *Task) ID() *project.GoModuleID {
return t.opts.goModule
Expand Down
16 changes: 1 addition & 15 deletions pkg/task/goimports/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ import (
)

const (
// DefaultExecName is the default name of the module executable.
DefaultExecName = "goimports"

// DefaultGoModulePath is the default module import path.
DefaultGoModulePath = "golang.org/x/tools/cmd/goimports"

Expand All @@ -34,9 +31,6 @@ type Options struct {
// env is the task specific environment.
env map[string]string

// execName is the unique executable name.
execName string

// extraArgs are additional arguments passed to the command.
extraArgs []string

Expand Down Expand Up @@ -78,8 +72,7 @@ func NewOptions(opts ...Option) (*Options, error) {
}

opt := &Options{
env: make(map[string]string),
execName: DefaultExecName,
env: make(map[string]string),
goModule: &project.GoModuleID{
Path: DefaultGoModulePath,
Version: version,
Expand All @@ -100,13 +93,6 @@ func WithEnv(env map[string]string) Option {
}
}

// WithExecName sets the name of the executable.
func WithExecName(execName string) Option {
return func(o *Options) {
o.execName = execName
}
}

// WithExtraArgs sets additional arguments to pass to the command.
func WithExtraArgs(extraArgs ...string) Option {
return func(o *Options) {
Expand Down
5 changes: 0 additions & 5 deletions pkg/task/golangcilint/golangcilint.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,6 @@ func (t *Task) Env() map[string]string {
return t.opts.env
}

// ExecName returns the executable name.
func (t *Task) ExecName() string {
return t.opts.execName
}

// ID returns the identifier of the Go module.
func (t *Task) ID() *project.GoModuleID {
return t.opts.goModule
Expand Down
16 changes: 1 addition & 15 deletions pkg/task/golangcilint/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ import (
)

const (
// DefaultExecName is the default name of the module executable.
DefaultExecName = "golangci-lint"

// DefaultGoModulePath is the default module import path.
DefaultGoModulePath = "github.com/golangci/golangci-lint/cmd/golangci-lint"

Expand All @@ -40,9 +37,6 @@ type Options struct {
// env is the task specific environment.
env map[string]string

// execName is the unique executable name.
execName string

// goModule is the Go module identifier.
goModule *project.GoModuleID

Expand All @@ -64,8 +58,7 @@ func NewOptions(opts ...Option) (*Options, error) {
}

opt := &Options{
env: make(map[string]string),
execName: DefaultExecName,
env: make(map[string]string),
goModule: &project.GoModuleID{
Path: DefaultGoModulePath,
Version: version,
Expand Down Expand Up @@ -98,13 +91,6 @@ func WithEnv(env map[string]string) Option {
}
}

// WithExecName sets the name of the executable.
func WithExecName(execName string) Option {
return func(o *Options) {
o.execName = execName
}
}

// WithModulePath sets the module import path.
// Defaults to DefaultGoModulePath.
func WithModulePath(path string) Option {
Expand Down
5 changes: 0 additions & 5 deletions pkg/task/gox/gox.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,6 @@ func (t *Task) Env() map[string]string {
return t.opts.env
}

// ExecName returns the executable name.
func (t *Task) ExecName() string {
return t.opts.execName
}

// ID returns the identifier of the Go module.
func (t *Task) ID() *project.GoModuleID {
return t.opts.goModule
Expand Down
16 changes: 1 addition & 15 deletions pkg/task/gox/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ import (
)

const (
// DefaultExecName is the default name of the module executable.
DefaultExecName = "gox"

// DefaultGoModulePath is the default module import path.
DefaultGoModulePath = "github.com/mitchellh/gox"

Expand Down Expand Up @@ -55,9 +52,6 @@ type Options struct {
// env is the task specific environment.
env map[string]string

// execName is the unique executable name.
execName string

// goCmd is the path to the Go toolchain executable.
goCmd string

Expand Down Expand Up @@ -91,8 +85,7 @@ func NewOptions(opts ...Option) (*Options, error) {
}

opt := &Options{
env: make(map[string]string),
execName: DefaultExecName,
env: make(map[string]string),
goModule: &project.GoModuleID{
Path: DefaultGoModulePath,
Version: version,
Expand Down Expand Up @@ -127,13 +120,6 @@ func WithEnv(env map[string]string) Option {
}
}

// WithExecName sets the name of the executable.
func WithExecName(execName string) Option {
return func(o *Options) {
o.execName = execName
}
}

// WithGoBuildOptions sets Go toolchain "build" command task options.
func WithGoBuildOptions(goBuildOpts ...taskGoBuild.Option) Option {
return func(o *Options) {
Expand Down
3 changes: 0 additions & 3 deletions pkg/task/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ type Exec interface {

// Env returns the task specific environment.
Env() map[string]string

// ExecName returns the executable name.
ExecName() string
}

// GoModule is a task for a Go module command.
Expand Down

0 comments on commit 8b30110

Please sign in to comment.