--- a/environment/environment.go Sun Dec 10 05:12:31 2023 -0600
+++ b/environment/environment.go Sun Dec 10 05:21:38 2023 -0600
@@ -18,21 +18,12 @@
type Environment map[string]string
-// splitEqual takes a string like "foo=bar" and returns it as ("foo", "bar")
-func splitEqual(value string) (string, string) {
- parts := strings.SplitN(value, "=", 2)
- return parts[0], parts[1]
func New(items ...string) Environment {
@@ -41,10 +32,7 @@
func (e Environment) Copy() Environment {
@@ -52,9 +40,7 @@
// Merge will merge another environment into the current environment
// overwriting any existing items
func (e Environment) Merge(env Environment) Environment {
- for k, v := range env {
@@ -62,7 +48,7 @@
// MergeSlice will merge a slice of strings in key or key=value formats.
func (e Environment) MergeSlice(items []string) Environment {
for _, item := range items {
- k, v := splitEqual(item)
+ k, v, _ := strings.Cut(item, "=") --- a/environment/mapper.go Sun Dec 10 05:12:31 2023 -0600
+++ b/environment/mapper.go Sun Dec 10 05:21:38 2023 -0600
@@ -41,9 +41,9 @@
for _, item := range e.env {
- if parts := strings.SplitN(item, "=", 2); parts[0] == name {
+ if varName, varValue, valueFound := strings.Cut(item, "="); varName == name { --- a/exec/generator.go Sun Dec 10 05:12:31 2023 -0600
+++ b/exec/generator.go Sun Dec 10 05:21:38 2023 -0600
@@ -17,7 +17,7 @@
@@ -28,15 +28,13 @@
// Generator represents a command generator.
// NewGenerator creates a new generator initialized with the gives arguments.
func NewGenerator(args ...string) *Generator {
- args: make([]string, minAlloc),
+ args: make([]string, 0, minAlloc), @@ -44,24 +42,6 @@
-// resize will resize the slice to the required size or minimum allocation
-// which ever is larger.
-func (g *Generator) resize(reqSize int) {
- if g.next >= len(g.args) {
- if reqSize > minAlloc {
- newArgs := make([]string, newSize)
// Append appends the given arguments to the end of the arguments.
func (g *Generator) Append(args ...string) {
@@ -76,11 +56,7 @@
- for _, item := range args {
+ g.args = slices.Insert(g.args, len(g.args), args...) // Prepend prepends the given arguments to the beginning of the arguments.
@@ -97,27 +73,7 @@
- // allocate a new slice that's the size of the
- newSize := int(math.Max(float64(len(args)), float64(minAlloc))) + len(g.args)
- newArgs := make([]string, newSize)
- // set our current index to 0
- // add the prepended items
- for ; idx < len(args); idx++ {
- newArgs[idx] = args[idx]
- // add the original items
- for ; idx < g.next+offset; idx++ {
- newArgs[idx] = g.args[idx-offset]
+ g.args = slices.Insert(g.args, 0, args...) // Command returns the currently built command.
@@ -125,10 +81,5 @@
- ret := make([]string, g.next)
- for i := 0; i < g.next; i++ {
+ return slices.Clone(g.args) --- a/fs/pathspec.go Sun Dec 10 05:12:31 2023 -0600
+++ b/fs/pathspec.go Sun Dec 10 05:21:38 2023 -0600
@@ -29,17 +29,13 @@
// If there is no colon, then either "." (the current working directory)
// will be returned as the destination.
func ParsePathSpec(spec string) *PathSpec {
- parts := strings.SplitN(spec, ":", 2)
+ src, dst, found := strings.Cut(spec, ":")
+ return &PathSpec{src: src, dst: dst} func (ps *PathSpec) Source() string {
--- a/go.mod Sun Dec 10 05:12:31 2023 -0600
+++ b/go.mod Sun Dec 10 05:21:38 2023 -0600
@@ -24,4 +24,4 @@
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
--- a/tasks/clean.go Sun Dec 10 05:12:31 2023 -0600
+++ b/tasks/clean.go Sun Dec 10 05:21:38 2023 -0600
@@ -53,20 +53,6 @@
-func sanitizeFiles(base string, files, env environment.Environment) ([]string, error) {
- for _, file := range files {
- sanitized, err := sanitizeFile(base, file, env)
- list = append(list, sanitized)
// Execute runs the clean task.
func (c *Clean) Execute(name string, logger *log.Entry, env environment.Environment, rt *runtime.Runtime) error {
fullEnv := environment.New()