mirror of
https://github.com/go-task/task.git
synced 2026-06-24 21:26:04 +00:00
refactor: enable gofmt linter and fix all issues
- also rewrite 'interface{}' as 'any'
This commit is contained in:
committed by
Andrey Nering
parent
a6d57496c2
commit
aab51c331f
@@ -12,8 +12,8 @@ import (
|
||||
func TestPreconditionParse(t *testing.T) {
|
||||
tests := []struct {
|
||||
content string
|
||||
v interface{}
|
||||
expected interface{}
|
||||
v any
|
||||
expected any
|
||||
}{
|
||||
{
|
||||
"test -f foo.txt",
|
||||
|
||||
@@ -24,8 +24,8 @@ vars:
|
||||
)
|
||||
tests := []struct {
|
||||
content string
|
||||
v interface{}
|
||||
expected interface{}
|
||||
v any
|
||||
expected any
|
||||
}{
|
||||
{
|
||||
yamlCmd,
|
||||
@@ -38,8 +38,8 @@ vars:
|
||||
&taskfile.Cmd{Task: "another-task", Vars: &taskfile.Vars{
|
||||
Keys: []string{"PARAM1", "PARAM2"},
|
||||
Mapping: map[string]taskfile.Var{
|
||||
"PARAM1": taskfile.Var{Static: "VALUE1"},
|
||||
"PARAM2": taskfile.Var{Static: "VALUE2"},
|
||||
"PARAM1": {Static: "VALUE1"},
|
||||
"PARAM2": {Static: "VALUE2"},
|
||||
},
|
||||
}},
|
||||
},
|
||||
@@ -54,7 +54,7 @@ vars:
|
||||
&taskfile.Cmd{Task: "some_task", Vars: &taskfile.Vars{
|
||||
Keys: []string{"PARAM1"},
|
||||
Mapping: map[string]taskfile.Var{
|
||||
"PARAM1": taskfile.Var{Static: "var"},
|
||||
"PARAM1": {Static: "var"},
|
||||
},
|
||||
}, Defer: true},
|
||||
},
|
||||
@@ -69,8 +69,8 @@ vars:
|
||||
&taskfile.Dep{Task: "another-task", Vars: &taskfile.Vars{
|
||||
Keys: []string{"PARAM1", "PARAM2"},
|
||||
Mapping: map[string]taskfile.Var{
|
||||
"PARAM1": taskfile.Var{Static: "VALUE1"},
|
||||
"PARAM2": taskfile.Var{Static: "VALUE2"},
|
||||
"PARAM1": {Static: "VALUE1"},
|
||||
"PARAM2": {Static: "VALUE2"},
|
||||
},
|
||||
}},
|
||||
},
|
||||
|
||||
@@ -82,8 +82,8 @@ func (vs *Vars) Range(yield func(key string, value Var) error) error {
|
||||
|
||||
// ToCacheMap converts Vars to a map containing only the static
|
||||
// variables
|
||||
func (vs *Vars) ToCacheMap() (m map[string]interface{}) {
|
||||
m = make(map[string]interface{}, vs.Len())
|
||||
func (vs *Vars) ToCacheMap() (m map[string]any) {
|
||||
m = make(map[string]any, vs.Len())
|
||||
_ = vs.Range(func(k string, v Var) error {
|
||||
if v.Sh != "" {
|
||||
// Dynamic variable is not yet resolved; trigger
|
||||
@@ -112,7 +112,7 @@ func (vs *Vars) Len() int {
|
||||
// Var represents either a static or dynamic variable.
|
||||
type Var struct {
|
||||
Static string
|
||||
Live interface{}
|
||||
Live any
|
||||
Sh string
|
||||
Dir string
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user