diff options
author | satotake <doublequotation@gmail.com> | 2018-08-05 21:59:29 +0900 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2018-08-06 09:54:26 +0200 |
commit | d40116e5f941e4734ed3bed69dce8ffe11fc76b2 (patch) | |
tree | 897e0277ff7a324973dc05a29d4b83940fb7ef56 | |
parent | c362634b7d8802ea81b0b4341c800a9f78f7cd7c (diff) |
Renmae FileStat Stat
-rw-r--r-- | tpl/os/init.go | 2 | ||||
-rw-r--r-- | tpl/os/os.go | 4 | ||||
-rw-r--r-- | tpl/os/os_test.go | 4 |
3 files changed, 5 insertions, 5 deletions
diff --git a/tpl/os/init.go b/tpl/os/init.go index b11e742eb..0b52ddea2 100644 --- a/tpl/os/init.go +++ b/tpl/os/init.go @@ -55,7 +55,7 @@ func init() { }, ) - ns.AddMethodMapping(ctx.FileStat, + ns.AddMethodMapping(ctx.Stat, []string{"fileStat"}, [][2]string{ {`{{ (fileStat "files/README.txt").Size }}`, `11`}, diff --git a/tpl/os/os.go b/tpl/os/os.go index 04f151ec9..aca80ae9d 100644 --- a/tpl/os/os.go +++ b/tpl/os/os.go @@ -131,8 +131,8 @@ func (ns *Namespace) FileExists(i interface{}) (bool, error) { return status, nil } -// FileStat Stat returns the os.FileInfo structure describing file. -func (ns *Namespace) FileStat(i interface{}) (_os.FileInfo, error) { +// Stat returns the os.FileInfo structure describing file. +func (ns *Namespace) Stat(i interface{}) (_os.FileInfo, error) { path, err := cast.ToStringE(i) if err != nil { return nil, err diff --git a/tpl/os/os_test.go b/tpl/os/os_test.go index 60e6b1f63..46dafd842 100644 --- a/tpl/os/os_test.go +++ b/tpl/os/os_test.go @@ -100,7 +100,7 @@ func TestFileExists(t *testing.T) { } } -func TestFileStat(t *testing.T) { +func TestStat(t *testing.T) { t.Parallel() workingDir := "/home/hugo" @@ -122,7 +122,7 @@ func TestFileStat(t *testing.T) { {"", nil}, } { errMsg := fmt.Sprintf("[%d] %v", i, test) - result, err := ns.FileStat(test.filename) + result, err := ns.Stat(test.filename) if test.expect == nil { require.Error(t, err, errMsg) |