1
0
mirror of https://github.com/go-task/task.git synced 2025-11-25 22:32:55 +02:00

feat: enforce gofumpt linter

This commit is contained in:
Pete Davison
2023-03-31 19:13:29 +00:00
committed by Andrey Nering
parent aab51c331f
commit 09c9094a6b
24 changed files with 84 additions and 70 deletions

View File

@@ -32,7 +32,6 @@ type IncludedTaskfiles struct {
// UnmarshalYAML implements the yaml.Unmarshaler interface.
func (tfs *IncludedTaskfiles) UnmarshalYAML(node *yaml.Node) error {
switch node.Kind {
case yaml.MappingNode:
// NOTE(@andreynering): on this style of custom unmarshalling,
// even number contains the keys, while odd numbers contains

View File

@@ -7,10 +7,8 @@ import (
"gopkg.in/yaml.v3"
)
var (
// ErrCantUnmarshalPrecondition is returned for invalid precond YAML.
ErrCantUnmarshalPrecondition = errors.New("task: Can't unmarshal precondition value")
)
// ErrCantUnmarshalPrecondition is returned for invalid precond YAML.
var ErrCantUnmarshalPrecondition = errors.New("task: Can't unmarshal precondition value")
// Precondition represents a precondition necessary for a task to run
type Precondition struct {

View File

@@ -25,14 +25,16 @@ func TestPreconditionParse(t *testing.T) {
&taskfile.Precondition{},
&taskfile.Precondition{Sh: "[ 1 = 0 ]", Msg: "[ 1 = 0 ] failed"},
},
{`
{
`
sh: "[ 1 = 2 ]"
msg: "1 is not 2"
`,
&taskfile.Precondition{},
&taskfile.Precondition{Sh: "[ 1 = 2 ]", Msg: "1 is not 2"},
},
{`
{
`
sh: "[ 1 = 2 ]"
msg: "1 is not 2"
`,

View File

@@ -263,8 +263,8 @@ func checkCircularIncludes(node *ReaderNode) error {
if node.Parent == nil {
return errors.New("task: failed to check for include cycle: node.Parent was nil")
}
var curNode = node
var basePath = filepathext.SmartJoin(node.Dir, node.Entrypoint)
curNode := node
basePath := filepathext.SmartJoin(node.Dir, node.Entrypoint)
for curNode.Parent != nil {
curNode = curNode.Parent
curPath := filepathext.SmartJoin(curNode.Dir, curNode.Entrypoint)

View File

@@ -34,7 +34,6 @@ type Taskfile struct {
func (tf *Taskfile) UnmarshalYAML(node *yaml.Node) error {
switch node.Kind {
case yaml.MappingNode:
var taskfile struct {
Version *semver.Version

View File

@@ -15,7 +15,6 @@ type Vars struct {
func (vs *Vars) UnmarshalYAML(node *yaml.Node) error {
switch node.Kind {
case yaml.MappingNode:
// NOTE(@andreynering): on this style of custom unmarshalling,
// even number contains the keys, while odd numbers contains