Skip to content

Commit

Permalink
refactor: use strings.Builder
Browse files Browse the repository at this point in the history
  • Loading branch information
jeroenrinzema committed Sep 4, 2020
1 parent 709bfb2 commit 81e84fd
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions cmd/semaphore/functions/strconcat.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package functions

import (
"strings"

"github.com/jexia/semaphore/pkg/functions"
"github.com/jexia/semaphore/pkg/references"
"github.com/jexia/semaphore/pkg/specs"
Expand Down Expand Up @@ -28,7 +30,7 @@ func Strconcat(args ...*specs.Property) (*specs.Property, functions.Exec, error)
}

handle := func(store references.Store) error {
var result string
result := strings.Builder{}

for _, arg := range args {
var value string
Expand All @@ -44,10 +46,13 @@ func Strconcat(args ...*specs.Property) (*specs.Property, functions.Exec, error)
}
}

result += value
_, err := result.WriteString(value)
if err != nil {
return err
}
}

store.StoreValue("", ".", result)
store.StoreValue("", ".", result.String())
return nil
}

Expand Down

0 comments on commit 81e84fd

Please sign in to comment.