Commit 3041f2a3 authored by Roger Peppe's avatar Roger Peppe Committed by Rob Pike

exp/template: make Set.MustParse* methods return the set.

This brings them into line with the Template.MustParse* methods
and makes it possible to use them in global variable initializations.

R=r
CC=golang-dev
https://golang.org/cl/4798059
parent fa249cae
......@@ -192,11 +192,12 @@ func (s *Set) ParseTemplateFile(filenames ...string) os.Error {
// MustParseTemplateFile is like ParseTemplateFile but
// panics if there is an error.
func (s *Set) MustParseTemplateFile(filenames ...string) {
func (s *Set) MustParseTemplateFile(filenames ...string) *Set {
err := s.ParseTemplateFile(filenames...)
if err != nil {
panic(err)
}
return s
}
// ParseTemplateFiles parses the template files matched by the
......@@ -228,11 +229,12 @@ func (s *Set) ParseTemplateFiles(pattern string) os.Error {
// MustParseTemplateFile is like ParseTemplateFiles but
// panics if there is an error.
func (s *Set) MustParseTemplateFiles(pattern string) {
func (s *Set) MustParseTemplateFiles(pattern string) *Set {
err := s.ParseTemplateFiles(pattern)
if err != nil {
panic(err)
}
return s
}
// ParseTemplateFile creates a set by parsing the named files,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment