diff --git a/template.go b/template.go index 7f5e6688f..dcb2c8b17 100644 --- a/template.go +++ b/template.go @@ -60,6 +60,7 @@ func gatherTemplates(o *Config) (templates []*tplate, err error) { templates = []*tplate{{ name: "", contents: o.Input, + mode: os.FileMode(0644), }} if len(o.OutputFiles) == 1 { diff --git a/template_test.go b/template_test.go index a58b0e224..721ba4a5c 100644 --- a/template_test.go +++ b/template_test.go @@ -159,6 +159,15 @@ func TestGatherTemplates(t *testing.T) { assert.Equal(t, "foo", templates[0].contents) assert.Equal(t, Stdout, templates[0].target) + templates, err = gatherTemplates(&Config{ + Input: "foo", + OutputFiles: []string{"out"}, + }) + assert.NoError(t, err) + assert.Len(t, templates, 1) + assert.Equal(t, "out", templates[0].targetPath) + assert.Equal(t, os.FileMode(0644), templates[0].mode) + templates, err = gatherTemplates(&Config{ InputFiles: []string{"foo"}, OutputFiles: []string{"out"},