mirror of
				https://github.com/go-task/task.git
				synced 2025-10-30 23:58:01 +02:00 
			
		
		
		
	refactor: orderedmap package -> omap
This commit is contained in:
		| @@ -7,7 +7,7 @@ import ( | ||||
| 	"github.com/stretchr/testify/assert" | ||||
|  | ||||
| 	"github.com/go-task/task/v3/args" | ||||
| 	"github.com/go-task/task/v3/internal/orderedmap" | ||||
| 	"github.com/go-task/task/v3/internal/omap" | ||||
| 	"github.com/go-task/task/v3/taskfile/ast" | ||||
| ) | ||||
|  | ||||
| @@ -33,7 +33,7 @@ func TestArgs(t *testing.T) { | ||||
| 				{Task: "task-c"}, | ||||
| 			}, | ||||
| 			ExpectedGlobals: &ast.Vars{ | ||||
| 				OrderedMap: orderedmap.FromMapWithOrder( | ||||
| 				OrderedMap: omap.FromMapWithOrder( | ||||
| 					map[string]ast.Var{ | ||||
| 						"FOO": {Value: "bar"}, | ||||
| 						"BAR": {Value: "baz"}, | ||||
| @@ -49,7 +49,7 @@ func TestArgs(t *testing.T) { | ||||
| 				{Task: "task-a"}, | ||||
| 			}, | ||||
| 			ExpectedGlobals: &ast.Vars{ | ||||
| 				OrderedMap: orderedmap.FromMapWithOrder( | ||||
| 				OrderedMap: omap.FromMapWithOrder( | ||||
| 					map[string]ast.Var{ | ||||
| 						"CONTENT": {Value: "with some spaces"}, | ||||
| 					}, | ||||
| @@ -64,7 +64,7 @@ func TestArgs(t *testing.T) { | ||||
| 				{Task: "task-b"}, | ||||
| 			}, | ||||
| 			ExpectedGlobals: &ast.Vars{ | ||||
| 				OrderedMap: orderedmap.FromMapWithOrder( | ||||
| 				OrderedMap: omap.FromMapWithOrder( | ||||
| 					map[string]ast.Var{ | ||||
| 						"FOO": {Value: "bar"}, | ||||
| 					}, | ||||
| @@ -84,7 +84,7 @@ func TestArgs(t *testing.T) { | ||||
| 			Args:          []string{"FOO=bar", "BAR=baz"}, | ||||
| 			ExpectedCalls: []ast.Call{}, | ||||
| 			ExpectedGlobals: &ast.Vars{ | ||||
| 				OrderedMap: orderedmap.FromMapWithOrder( | ||||
| 				OrderedMap: omap.FromMapWithOrder( | ||||
| 					map[string]ast.Var{ | ||||
| 						"FOO": {Value: "bar"}, | ||||
| 						"BAR": {Value: "baz"}, | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| package orderedmap | ||||
| package omap | ||||
| 
 | ||||
| import ( | ||||
| 	"fmt" | ||||
| @@ -1,4 +1,4 @@ | ||||
| package orderedmap | ||||
| package omap | ||||
| 
 | ||||
| import ( | ||||
| 	"testing" | ||||
| @@ -10,7 +10,7 @@ import ( | ||||
| 	"github.com/stretchr/testify/assert" | ||||
| 	"github.com/stretchr/testify/require" | ||||
|  | ||||
| 	"github.com/go-task/task/v3/internal/orderedmap" | ||||
| 	"github.com/go-task/task/v3/internal/omap" | ||||
| 	"github.com/go-task/task/v3/internal/output" | ||||
| 	"github.com/go-task/task/v3/internal/templater" | ||||
| 	"github.com/go-task/task/v3/taskfile/ast" | ||||
| @@ -48,7 +48,7 @@ func TestGroup(t *testing.T) { | ||||
| func TestGroupWithBeginEnd(t *testing.T) { | ||||
| 	tmpl := templater.Templater{ | ||||
| 		Vars: &ast.Vars{ | ||||
| 			OrderedMap: orderedmap.FromMap(map[string]ast.Var{ | ||||
| 			OrderedMap: omap.FromMap(map[string]ast.Var{ | ||||
| 				"VAR1": {Value: "example-value"}, | ||||
| 			}), | ||||
| 		}, | ||||
|   | ||||
| @@ -7,7 +7,7 @@ import ( | ||||
|  | ||||
| 	"github.com/go-task/task/v3/internal/execext" | ||||
| 	"github.com/go-task/task/v3/internal/filepathext" | ||||
| 	"github.com/go-task/task/v3/internal/orderedmap" | ||||
| 	omap "github.com/go-task/task/v3/internal/omap" | ||||
|  | ||||
| 	"gopkg.in/yaml.v3" | ||||
| ) | ||||
| @@ -27,7 +27,7 @@ type Include struct { | ||||
|  | ||||
| // Includes represents information about included tasksfiles | ||||
| type Includes struct { | ||||
| 	orderedmap.OrderedMap[string, Include] | ||||
| 	omap.OrderedMap[string, Include] | ||||
| } | ||||
|  | ||||
| // UnmarshalYAML implements the yaml.Unmarshaler interface. | ||||
|   | ||||
| @@ -7,7 +7,7 @@ import ( | ||||
| 	"github.com/stretchr/testify/require" | ||||
| 	"gopkg.in/yaml.v3" | ||||
|  | ||||
| 	"github.com/go-task/task/v3/internal/orderedmap" | ||||
| 	"github.com/go-task/task/v3/internal/omap" | ||||
| 	"github.com/go-task/task/v3/taskfile/ast" | ||||
| ) | ||||
|  | ||||
| @@ -39,7 +39,7 @@ vars: | ||||
| 			&ast.Cmd{}, | ||||
| 			&ast.Cmd{ | ||||
| 				Task: "another-task", Vars: &ast.Vars{ | ||||
| 					OrderedMap: orderedmap.FromMapWithOrder( | ||||
| 					OrderedMap: omap.FromMapWithOrder( | ||||
| 						map[string]ast.Var{ | ||||
| 							"PARAM1": {Value: "VALUE1"}, | ||||
| 							"PARAM2": {Value: "VALUE2"}, | ||||
| @@ -59,7 +59,7 @@ vars: | ||||
| 			&ast.Cmd{}, | ||||
| 			&ast.Cmd{ | ||||
| 				Task: "some_task", Vars: &ast.Vars{ | ||||
| 					OrderedMap: orderedmap.FromMapWithOrder( | ||||
| 					OrderedMap: omap.FromMapWithOrder( | ||||
| 						map[string]ast.Var{ | ||||
| 							"PARAM1": {Value: "var"}, | ||||
| 						}, | ||||
| @@ -79,7 +79,7 @@ vars: | ||||
| 			&ast.Dep{}, | ||||
| 			&ast.Dep{ | ||||
| 				Task: "another-task", Vars: &ast.Vars{ | ||||
| 					OrderedMap: orderedmap.FromMapWithOrder( | ||||
| 					OrderedMap: omap.FromMapWithOrder( | ||||
| 						map[string]ast.Var{ | ||||
| 							"PARAM1": {Value: "VALUE1"}, | ||||
| 							"PARAM2": {Value: "VALUE2"}, | ||||
|   | ||||
| @@ -5,18 +5,18 @@ import ( | ||||
|  | ||||
| 	"gopkg.in/yaml.v3" | ||||
|  | ||||
| 	"github.com/go-task/task/v3/internal/orderedmap" | ||||
| 	"github.com/go-task/task/v3/internal/omap" | ||||
| ) | ||||
|  | ||||
| // Tasks represents a group of tasks | ||||
| type Tasks struct { | ||||
| 	orderedmap.OrderedMap[string, *Task] | ||||
| 	omap.OrderedMap[string, *Task] | ||||
| } | ||||
|  | ||||
| func (t *Tasks) UnmarshalYAML(node *yaml.Node) error { | ||||
| 	switch node.Kind { | ||||
| 	case yaml.MappingNode: | ||||
| 		tasks := orderedmap.New[string, *Task]() | ||||
| 		tasks := omap.New[string, *Task]() | ||||
| 		if err := node.Decode(&tasks); err != nil { | ||||
| 			return err | ||||
| 		} | ||||
|   | ||||
| @@ -7,12 +7,12 @@ import ( | ||||
| 	"gopkg.in/yaml.v3" | ||||
|  | ||||
| 	"github.com/go-task/task/v3/internal/experiments" | ||||
| 	"github.com/go-task/task/v3/internal/orderedmap" | ||||
| 	"github.com/go-task/task/v3/internal/omap" | ||||
| ) | ||||
|  | ||||
| // Vars is a string[string] variables map. | ||||
| type Vars struct { | ||||
| 	orderedmap.OrderedMap[string, Var] | ||||
| 	omap.OrderedMap[string, Var] | ||||
| } | ||||
|  | ||||
| // ToCacheMap converts Vars to a map containing only the static | ||||
|   | ||||
		Reference in New Issue
	
	Block a user