Skip to content

Commit

Permalink
chore: go fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
gszr committed Mar 4, 2024
1 parent ef6193b commit 7c1e377
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions dot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"github.com/stretchr/testify/assert"
"gopkg.in/yaml.v3"
"os"
"testing"
"runtime"
"testing"
)

func isSymlink(path string) bool {
Expand Down Expand Up @@ -78,7 +78,7 @@ func TestDoCopy(t *testing.T) {
m = FileMapping{
From: "fixtures/gpg-agent.conf.input",
To: "out/gpg-agent.conf",
With: map[string]string {
With: map[string]string{
"PinentryPath": "/foo/bar",
},
}
Expand Down Expand Up @@ -365,11 +365,11 @@ func TestGetHomeDir(t *testing.T) {
}

func TestEvalTemplateString(t *testing.T) {
cases := map[string]string {
cases := map[string]string{
"{{ .v1 }}": "a value",
"{{ .v2 }}": "<no value>",
}
env := map[string]string {
env := map[string]string{
"v1": "a value",
}
for templ, want := range cases {
Expand All @@ -386,7 +386,7 @@ func TestEvalTemplate(t *testing.T) {
} else {
otherOs = "darwin"
}
with := map[string]string {
with := map[string]string{
"t1": "{{if eq .Os \"" + curOs + "\"}}it works{{end}}",
"t2": "{{if eq .Os \"" + otherOs + "\"}}must not be this{{end}}",
"t3": "{{if eq .Os \"" + otherOs + "\"}}must not be this{{else}}else{{end}}",
Expand Down
4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ func (dots Dots) validate() []error {
}

if mapping.As != "copy" && len(mapping.With) > 0 {
errs = append(errs, fmt.Errorf("%s: templating is only supported in `copy` mode ]", mapping.From));
errs = append(errs, fmt.Errorf("%s: templating is only supported in `copy` mode ]", mapping.From))
}
}
return errs
Expand Down Expand Up @@ -240,7 +240,7 @@ func evalTemplateString(templStr string, env map[string]string) string {
func evalTemplate(with map[string]string) map[string]string {
newMap := make(map[string]string, len(with))
for variable, templ := range with {
env := map[string]string{ "Os": runtime.GOOS }
env := map[string]string{"Os": runtime.GOOS}
newMap[variable] = evalTemplateString(templ, env)
}
return newMap
Expand Down

0 comments on commit 7c1e377

Please sign in to comment.