From 57a8ec74ce212843bb700c828d99a9c790819f95 Mon Sep 17 00:00:00 2001 From: yosssi Date: Mon, 12 May 2014 13:59:00 +0900 Subject: [PATCH 1/2] Add `AssetNames` function which returns the names of the assets. --- toc.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/toc.go b/toc.go index 0bd50da..5e4d982 100644 --- a/toc.go +++ b/toc.go @@ -39,6 +39,15 @@ func Asset(name string) ([]byte, error) { return nil, fmt.Errorf("Asset %%s not found", name) } +// AssetNames returns the names of the assets. +func AssetNames() []string { + names := make([]string, 0, len(_bindata)) + for name, _ := range _bindata { + names= append(names, name) + } + return names +} + // _bindata is a table, holding each asset generator, mapped to its name. var _bindata = map[string] func() ([]byte, error) { `) From e764a84fdfa3ac71fd420cb37bd0929feefe7dde Mon Sep 17 00:00:00 2001 From: yosssi Date: Mon, 12 May 2014 18:15:42 +0900 Subject: [PATCH 2/2] Fix the following things: * Change `for name, _ := range _bindata` to `for name := range _bindata {` * Format the souce codes --- toc.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/toc.go b/toc.go index 5e4d982..924a701 100644 --- a/toc.go +++ b/toc.go @@ -42,8 +42,8 @@ func Asset(name string) ([]byte, error) { // AssetNames returns the names of the assets. func AssetNames() []string { names := make([]string, 0, len(_bindata)) - for name, _ := range _bindata { - names= append(names, name) + for name := range _bindata { + names = append(names, name) } return names }