Пример #1
0
func (s *GopathSuite) TestIfTemplateIsFoundWhenVersionIsIgnored(c *C) {
	gpl := NewGoPathLoader()
	data, err := gpl.Load("nildev", "test-good", "")
	c.Assert(err, IsNil)
	expected, err := ioutil.ReadFile("./fixtures/good.tpl")
	c.Assert(err, IsNil)
	remaining, err := utils.PopLine(expected)
	c.Assert(err, IsNil)
	c.Assert(string(data), Equals, string(remaining))
}
Пример #2
0
func (gpl *goPathLoader) visit(path string, f os.FileInfo, err error) error {
	//fmt.Printf(" -- checking [%s/%s]", path, f.Name())
	if !f.IsDir() {
		if strings.Contains(f.Name(), ".tpl") {
			rez := gpl.analyseFile(path)
			if rez {
				data, err := ioutil.ReadFile(path)
				if err != nil {
					return err
				}

				remaining, err := utils.PopLine(data)
				if err != nil {
					return err
				}

				gpl.tpl = remaining
			}
		}
	}

	return nil
}