diff options
Diffstat (limited to 'src/pkg/template/helper.go')
-rw-r--r-- | src/pkg/template/helper.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/pkg/template/helper.go b/src/pkg/template/helper.go index c9b099856..1dc90f7ff 100644 --- a/src/pkg/template/helper.go +++ b/src/pkg/template/helper.go @@ -210,7 +210,8 @@ func ParseTemplateFiles(filenames ...string) (*Set, os.Error) { } // ParseTemplateGlob creates a set by parsing the files matched -// by the pattern, each of which defines a single template. Each +// by the pattern, each of which defines a single template. The pattern +// is processed by filepath.Glob and must match at least one file. Each // template will be named the base name of its file. // Unlike with ParseGlob, each file should be a stand-alone template // definition suitable for Template.Parse (not Set.Parse); that is, the @@ -225,6 +226,9 @@ func ParseTemplateGlob(pattern string) (*Set, os.Error) { if err != nil { return nil, err } + if len(filenames) == 0 { + return nil, fmt.Errorf("pattern matches no files: %#q", pattern) + } for _, filename := range filenames { t, err := ParseFile(filename) if err != nil { |