From 908d8aa9f2763971d86ea0acf07bc341a16b936b Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sun, 16 Oct 2016 01:02:01 +0900 Subject: [PATCH] examples/keyboard: Add example tags --- examples/keyboard/keyboard/gen.go | 8 +++++--- examples/{ => keyboard/keyboard}/generate.go | 6 ++++-- examples/keyboard/keyboard/keyrects.go | 4 +++- 3 files changed, 12 insertions(+), 6 deletions(-) rename examples/{ => keyboard/keyboard}/generate.go (88%) diff --git a/examples/keyboard/keyboard/gen.go b/examples/keyboard/keyboard/gen.go index 402fa0544..88fe71dc8 100644 --- a/examples/keyboard/keyboard/gen.go +++ b/examples/keyboard/keyboard/gen.go @@ -154,7 +154,7 @@ func outputKeyboardImage() (map[string]image.Rectangle, error) { palettedImg := image.NewPaletted(img.Bounds(), palette) draw.Draw(palettedImg, palettedImg.Bounds(), img, image.ZP, draw.Src) - f, err := os.Create("_resources/images/keyboard/keyboard.png") + f, err := os.Create("../../_resources/images/keyboard/keyboard.png") if err != nil { return nil, err } @@ -167,7 +167,9 @@ func outputKeyboardImage() (map[string]image.Rectangle, error) { const keyRectTmpl = `{{.License}} -// DO NOT EDIT: This file is auto-generated by genkeys.go. +// DO NOT EDIT: This file is auto-generated by gen.go. + +// +build example package keyboard @@ -191,7 +193,7 @@ func outputKeyRectsGo(k map[string]image.Rectangle) error { if err != nil { return err } - path := "keyboard/keyboard/keyrects.go" + path := "keyrects.go" f, err := os.Create(path) if err != nil { diff --git a/examples/generate.go b/examples/keyboard/keyboard/generate.go similarity index 88% rename from examples/generate.go rename to examples/keyboard/keyboard/generate.go index d4bef74f6..c1f579477 100644 --- a/examples/generate.go +++ b/examples/keyboard/keyboard/generate.go @@ -12,7 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:generate go run keyboard/keyboard/gen.go +// +build example + +//go:generate go run -tags=example gen.go //go:generate gofmt -s -w . -package example +package keyboard diff --git a/examples/keyboard/keyboard/keyrects.go b/examples/keyboard/keyboard/keyrects.go index 1455dce24..47c08161c 100644 --- a/examples/keyboard/keyboard/keyrects.go +++ b/examples/keyboard/keyboard/keyrects.go @@ -12,7 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -// DO NOT EDIT: This file is auto-generated by genkeys.go. +// DO NOT EDIT: This file is auto-generated by gen.go. + +// +build example package keyboard