template: template path is the directory
This commit is contained in:
parent
2b9e52e743
commit
31d6dcb656
|
@ -4,6 +4,7 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
"path/filepath"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"text/template"
|
"text/template"
|
||||||
|
@ -99,7 +100,7 @@ func funcGenTemplatePath(ctx *Context) interface{} {
|
||||||
return "", errors.New("template path not available")
|
return "", errors.New("template path not available")
|
||||||
}
|
}
|
||||||
|
|
||||||
return ctx.TemplatePath, nil
|
return filepath.Dir(ctx.TemplatePath), nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -128,7 +128,7 @@ func TestFuncTemplatePath(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx := &Context{
|
ctx := &Context{
|
||||||
TemplatePath: "foo",
|
TemplatePath: "foo/bar",
|
||||||
}
|
}
|
||||||
for _, tc := range cases {
|
for _, tc := range cases {
|
||||||
i := &I{Value: tc.Input}
|
i := &I{Value: tc.Input}
|
||||||
|
|
Loading…
Reference in New Issue