example: Add example tags

This commit is contained in:
Hajime Hoshi 2016-10-16 00:09:03 +09:00
parent 61676616a7
commit 23b2d086ee
18 changed files with 84 additions and 32 deletions

View File

@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
// +build example
package twenty48 package twenty48
import ( import (

View File

@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
// +build example
package twenty48 package twenty48
import ( import (

View File

@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
// +build example
package twenty48 package twenty48
import ( import (

View File

@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
// +build example
package twenty48 package twenty48
import ( import (

View File

@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
// +build example
package twenty48 package twenty48
import ( import (

View File

@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
// +build example
package twenty48_test package twenty48_test
import ( import (

View File

@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
// +build example
package blocks package blocks
import ( import (

View File

@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
// +build example
package blocks package blocks
import ( import (

View File

@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
// +build example
package blocks package blocks
import ( import (

View File

@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
// +build example
package blocks package blocks
import ( import (

View File

@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
// +build example
package blocks package blocks
import ( import (

View File

@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
// +build example
package blocks package blocks
import ( import (

View File

@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
// +build example
package blocks package blocks
import ( import (

View File

@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
// +build example
package blocks package blocks
import ( import (

View File

@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
// +build example
package blocks package blocks
import ( import (

View File

@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
// +build example
package common package common
import ( import (

View File

@ -12,7 +12,9 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
//go:generate go-bindata -nocompress -pkg=assets arcadefont.png // +build example
//go:generate go-bindata -nocompress -pkg=assets -tags=example arcadefont.png
//go:generate gofmt -s -w . //go:generate gofmt -s -w .
package assets package assets

View File

@ -1,10 +1,16 @@
// Code generated by go-bindata.
// sources:
// arcadefont.png
// DO NOT EDIT!
// +build example
package assets package assets
import ( import (
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"os" "os"
"path"
"path/filepath" "path/filepath"
"strings" "strings"
"time" "time"
@ -15,45 +21,45 @@ type asset struct {
info os.FileInfo info os.FileInfo
} }
type bindata_file_info struct { type bindataFileInfo struct {
name string name string
size int64 size int64
mode os.FileMode mode os.FileMode
modTime time.Time modTime time.Time
} }
func (fi bindata_file_info) Name() string { func (fi bindataFileInfo) Name() string {
return fi.name return fi.name
} }
func (fi bindata_file_info) Size() int64 { func (fi bindataFileInfo) Size() int64 {
return fi.size return fi.size
} }
func (fi bindata_file_info) Mode() os.FileMode { func (fi bindataFileInfo) Mode() os.FileMode {
return fi.mode return fi.mode
} }
func (fi bindata_file_info) ModTime() time.Time { func (fi bindataFileInfo) ModTime() time.Time {
return fi.modTime return fi.modTime
} }
func (fi bindata_file_info) IsDir() bool { func (fi bindataFileInfo) IsDir() bool {
return false return false
} }
func (fi bindata_file_info) Sys() interface{} { func (fi bindataFileInfo) Sys() interface{} {
return nil return nil
} }
var _arcadefont_png = []byte("\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\x80\x00\x00\x000\b\x03\x00\x00\x00\xee*\x82\x8c\x00\x00\x00\x06PLTE\x00\x00\x00\xff\xff\xff\xa5ٟ\xdd\x00\x00\x00\x01tRNS\x00@\xe6\xd8f\x00\x00\x03\x98IDATx\x9c\xc4X\x89\x96\xac(\f\xe5\xd6\xf3\xff\u007f9\xd3B\x96\x9b\x18ѩ\xe99/ݥ\x82\x81\xec\v~F\x00\xa0\xd7\xf5\x10\xf3t=\xdf#\xe1\xdbCY\xf4\x0e0>\xbb\x97F\xf9\xdc{\x8e\xe6\xbf\b*\xa2\xfc\\%X,\xf7\r\ti\x18\x90\xf9\xbf(bm#sNN|\xdeW\x98\xbes\x80W\xa4\x8d~B];\xc1\t\x89\x13\x14ǧ\xa1\x8e\x9d\x01{P\x04\x10\x8f\xa3\x19\xfbz\x9a@\x1e\x99\xb5\xf5\x0e\xffG\xc2,>\x01\xb2]\xb7o\xe6(\x99@\x12G2\xff\xd6rӌ\x8b!\t\xd1\xe8\x89\tYE\xeb\x04\xbd\xc8\u007f\xef\xc7H\x174a\xf2\x10\x05\xd5i\xff\x85\x9b\xfc\nli\x81\x9d,9\xcfZ\xa63\x92\x87\x11s\xa2\xc3\xceɈ\x884\x83\xb5\xf0ϴm(y\xbd\a*G\x8d\xaf\x8b\xe5\x05\xba[*\x1b\xe9^\x9c?6\xfcy<&\x1f8=B\xc02\x12}\x01q\x1cQOq\xbb\x85\x88N\xf5\xd0I\xcd\xe5Q\t$cJ\"\xc8҇)HA\xc1u\xe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+\xbbUɄ>\xc6(=\xe2(%\x83\x9e\x904\xb5\xf0y\xd9y\x8f<`\x89P3 \xf8>bl\x89\x11\x1e\xcd\"\xa5\xdc\\m\xa2\xb3\x9eZi\xffc\xa7\xa9\xbe\xa1y\v\xef\x9aރ\xd1+\x89\x8b\b<z\xf1Q\xea\xe9\xd0vB\xce\x03k\x19T]q\x1fMj\x16\xb9(\bcېd\x01\xfcT\xf8-<\xb5\x8e\xbf\a_}\x00\xe4\x95\xd8m\xb3-\xc7\xff\x11\xaa\v\xb5\x1c\x1c).s\x97㫨\xe1I?\xc3\xcd?\xdb\xf0\x15[\xb3-\x8f\x83\x90\xa2p^ٞ\x8b\a\xf5\xae.\xe8\xe0\xc3XƔ\xa1\x9f!#>:\x13\x88m\xf4`|\x17\xb6\x86\x83U\xc9.\x85\xcb\xf0/\x06\xc6@\x0e\xb7`\xa3\x8f\x11o|\xac#BtP\x89\xfe\x068\x80\x81Z\xd9\xea'\x9d\xd4s\xc8`\r'\u007f\x18\xe3\xe2\x03\x86\xd9Z䖁o\xe1\xcb\xf8\xff'\x00\x00\xff\xff\"\xd9\xedҰ\xcb\xea\x95\x00\x00\x00\x00IEND\xaeB`\x82") var _arcadefontPng = []byte("\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\x80\x00\x00\x000\b\x03\x00\x00\x00\xee*\x82\x8c\x00\x00\x00\x06PLTE\x00\x00\x00\xff\xff\xff\xa5\u065f\xdd\x00\x00\x00\x01tRNS\x00@\xe6\xd8f\x00\x00\x03\x98IDATx\x9c\xc4X\x89\x96\xac(\f\xe5\xd6\xf3\xff\u007f9\xd3B\x96\x9b\x18\u0469\xe99/\u0765\x82\x81\xec\v~F\x00\xa0\xd7\xf5\x10\xf3t=\xdf#\xe1\xdbCY\xf4\x0e0>\xbb\x97F\xf9\xdc{\x8e\xe6\xbf\b*\xa2\xfc\\%X,\xf7\r\ti\x18\x90\xf9\xbf(bm#sNN|\xdeW\x98\xbes\x80W\xa4\x8d~B];\xc1\t\x89\x13\x14\u01e7\xa1\x8e\x9d\x01{P\x04\x10\x8f\xa3\x19\xfbz\x9a@\x1e\x99\xb5\xf5\x0e\xffG\xc2,>\x01\xb2]\xb7o\xe6(\x99@\x12G2\xff\xd6r\u04cc\x8b!\t\xd1\xe8\x89\tYE\xeb\x04\xbd\xc8\u007f\xef\xc7H\x174a\xf2\x10\x05\xd5i\xff\x85\x9b\xfc\nli\x81\x9d,9\xcfZ\xa63\x92\x87\x11s\xa2\xc3\xce\u0248\x884\x83\xb5\xf0\u03f4m(y\xbd\a*G\x8d\xaf\x8b\xe5\x05\xba[*\x1b\xe9^\x9c?6\xfcy<&\x1f8=B\xc02\x12}\x01q\x1cQOq\xbb\x85\x88N\xf5\xd0I\xcd\xe5Q\t$cJ\"\xc8\u0487)HA\xc1u\xe3\xda\xd79\x90\u034ff\xc1\xf0x\x82\xe5*\x962\xe6]A\xb0\x90\xbd\xec\xef\x02\x93\x8f\xa4\xf7\x87\xaa\x9f\xe9',SM#Hp\xd4\x1b\xdb^'\x95\x13\x96\xf1\x85\xa4\xc2\xe4\xdd\xccj\x8a\x8eb1\x9b/\xf4!\rc1\xd8\xc8\xf4;\xf0*\u05c0\x95~\t\u007fR\x84i\xc65\xa4o\u0709\xd9\t\x91\xe69l\v\xfe\xe9\x84\u04df\xf4\xa5\x19\vP\xf7_\xfe\x91\x8d\xd8\xe9u\x8c\xceM\xf2\x04,\x9c\x89!\xc8g\xe6!wd\xe4\u0152*\xfdf\xf3\x16*J\u06e8\x1c\xc1\x19\xe3u\x9b\xe7\xfc\xa03ro\xea{\x16\x91\x198\u0167\xfc\xe7q^\xa1\x98`P\xee\xbc+\xa3\xb9\xbe\xab\xa4Y\xde\xcf\xe9\x15K\xd3\"\x97*\x0f\xdc\xca\u0499e\xe2r\u01c6\a\t\u01a9\x01A\xed\x94\x16\x8e\x00T\f\u01e5\xdcI\xd3;\u03ce5R)\xa9\xb6\xe8\u0096\xff\u03c9\xe0\r\x1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ff'\x00\x00\xff\xff\"\xd9\xed\u04b0\xcb\xea\x95\x00\x00\x00\x00IEND\xaeB`\x82")
func arcadefont_png_bytes() ([]byte, error) { func arcadefontPngBytes() ([]byte, error) {
return _arcadefont_png, nil return _arcadefontPng, nil
} }
func arcadefont_png() (*asset, error) { func arcadefontPng() (*asset, error) {
bytes, err := arcadefont_png_bytes() bytes, err := arcadefontPngBytes()
if err != nil { if err != nil {
return nil, err return nil, err
} }
info := bindata_file_info{name: "arcadefont.png", size: 1008, mode: os.FileMode(420), modTime: time.Unix(1463226773, 0)} info := bindataFileInfo{name: "arcadefont.png", size: 1008, mode: os.FileMode(420), modTime: time.Unix(1463226773, 0)}
a := &asset{bytes: bytes, info: info} a := &asset{bytes: bytes, info: info}
return a, nil return a, nil
} }
@ -73,6 +79,17 @@ func Asset(name string) ([]byte, error) {
return nil, fmt.Errorf("Asset %s not found", name) return nil, fmt.Errorf("Asset %s not found", name)
} }
// MustAsset is like Asset but panics when Asset would return an error.
// It simplifies safe initialization of global variables.
func MustAsset(name string) []byte {
a, err := Asset(name)
if err != nil {
panic("asset: Asset(" + name + "): " + err.Error())
}
return a
}
// AssetInfo loads and returns the asset info for the given name. // AssetInfo loads and returns the asset info for the given name.
// It returns an error if the asset could not be found or // It returns an error if the asset could not be found or
// could not be loaded. // could not be loaded.
@ -99,7 +116,7 @@ func AssetNames() []string {
// _bindata is a table, holding each asset generator, mapped to its name. // _bindata is a table, holding each asset generator, mapped to its name.
var _bindata = map[string]func() (*asset, error){ var _bindata = map[string]func() (*asset, error){
"arcadefont.png": arcadefont_png, "arcadefont.png": arcadefontPng,
} }
// AssetDir returns the file names below a certain // AssetDir returns the file names below a certain
@ -131,22 +148,22 @@ func AssetDir(name string) ([]string, error) {
return nil, fmt.Errorf("Asset %s not found", name) return nil, fmt.Errorf("Asset %s not found", name)
} }
rv := make([]string, 0, len(node.Children)) rv := make([]string, 0, len(node.Children))
for name := range node.Children { for childName := range node.Children {
rv = append(rv, name) rv = append(rv, childName)
} }
return rv, nil return rv, nil
} }
type _bintree_t struct { type bintree struct {
Func func() (*asset, error) Func func() (*asset, error)
Children map[string]*_bintree_t Children map[string]*bintree
} }
var _bintree = &_bintree_t{nil, map[string]*_bintree_t{ var _bintree = &bintree{nil, map[string]*bintree{
"arcadefont.png": {arcadefont_png, map[string]*_bintree_t{}}, "arcadefont.png": {arcadefontPng, map[string]*bintree{}},
}} }}
// Restore an asset under the given directory // RestoreAsset restores an asset under the given directory
func RestoreAsset(dir, name string) error { func RestoreAsset(dir, name string) error {
data, err := Asset(name) data, err := Asset(name)
if err != nil { if err != nil {
@ -156,7 +173,7 @@ func RestoreAsset(dir, name string) error {
if err != nil { if err != nil {
return err return err
} }
err = os.MkdirAll(_filePath(dir, path.Dir(name)), os.FileMode(0755)) err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755))
if err != nil { if err != nil {
return err return err
} }
@ -171,19 +188,20 @@ func RestoreAsset(dir, name string) error {
return nil return nil
} }
// Restore assets under the given directory recursively // RestoreAssets restores an asset under the given directory recursively
func RestoreAssets(dir, name string) error { func RestoreAssets(dir, name string) error {
children, err := AssetDir(name) children, err := AssetDir(name)
if err != nil { // File // File
if err != nil {
return RestoreAsset(dir, name) return RestoreAsset(dir, name)
} else { // Dir }
// Dir
for _, child := range children { for _, child := range children {
err = RestoreAssets(dir, path.Join(name, child)) err = RestoreAssets(dir, filepath.Join(name, child))
if err != nil { if err != nil {
return err return err
} }
} }
}
return nil return nil
} }