mirror of
https://github.com/golang/go
synced 2024-11-21 13:24:40 -07:00
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
This commit is contained in:
parent
fa249cae38
commit
3041f2a37c
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user