Commit 31d6dcb6 authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

template: template path is the directory

parent 2b9e52e7
...@@ -4,6 +4,7 @@ import ( ...@@ -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{} { ...@@ -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) { ...@@ -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}
......
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