Skip to content

Commit

Permalink
[fix] broken Go 1.9 compatibility
Browse files Browse the repository at this point in the history
This CL addresses Go 1.9 compatibility issue along with adding back Go
1.9 to travis testing setup to prevent such bugs.

Issue: #895
  • Loading branch information
benjaminch committed May 20, 2019
1 parent c409042 commit 7f857f0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
language: go

go:
- '1.9'
- '1.10'
- '1.11.1'

Expand Down
9 changes: 5 additions & 4 deletions macros/macros.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package macros

import (
"strings"
"bytes"
"text/template"
)

Expand All @@ -19,11 +19,12 @@ type UserSyncTemplateParams struct {

// ResolveMacros resolves macros in the given template with the provided params
func ResolveMacros(aTemplate template.Template, params interface{}) (string, error) {
strBuilder := strings.Builder{}
err := aTemplate.Execute(&strBuilder, params)
strBuf := bytes.Buffer{}

err := aTemplate.Execute(&strBuf, params)
if err != nil {
return "", err
}
res := strBuilder.String()
res := strBuf.String()
return res, nil
}

0 comments on commit 7f857f0

Please sign in to comment.