cmd/tailscale: use go:embed directives for image files

Fixes tailscale/tailscale#2243

Signed-off-by: Elias Naur <mail@eliasnaur.com>
pull/13/head
Elias Naur 3 years ago
parent b57f06455d
commit 131bf27995

File diff suppressed because one or more lines are too long

@ -28,8 +28,6 @@ import (
"tailscale.com/wgengine/router" "tailscale.com/wgengine/router"
) )
//go:generate go run github.com/go-bindata/go-bindata/go-bindata -nocompress -o logo.go tailscale.png google.png
type App struct { type App struct {
jvm *jni.JVM jvm *jni.JVM
// appCtx is a global reference to the com.tailscale.ipn.App instance. // appCtx is a global reference to the com.tailscale.ipn.App instance.

@ -8,5 +8,4 @@ package main
import ( import (
_ "gioui.org/cmd/gogio" _ "gioui.org/cmd/gogio"
_ "github.com/go-bindata/go-bindata/go-bindata"
) )

@ -28,6 +28,8 @@ import (
"tailscale.com/ipn" "tailscale.com/ipn"
"tailscale.com/tailcfg" "tailscale.com/tailcfg"
_ "embed"
"eliasnaur.com/font/roboto/robotobold" "eliasnaur.com/font/roboto/robotobold"
"eliasnaur.com/font/roboto/robotoregular" "eliasnaur.com/font/roboto/robotoregular"
@ -139,6 +141,13 @@ type (
D = layout.Dimensions D = layout.Dimensions
) )
var (
//go:embed tailscale.png
tailscaleLogo []byte
//go:embed google.png
googleLogo []byte
)
func newUI(store *stateStore) (*UI, error) { func newUI(store *stateStore) (*UI, error) {
searchIcon, err := widget.NewIcon(icons.ActionSearch) searchIcon, err := widget.NewIcon(icons.ActionSearch)
if err != nil { if err != nil {
@ -152,19 +161,11 @@ func newUI(store *stateStore) (*UI, error) {
if err != nil { if err != nil {
return nil, err return nil, err
} }
logoData, err := tailscalePngBytes() logo, _, err := image.Decode(bytes.NewReader(tailscaleLogo))
if err != nil {
return nil, err
}
logo, _, err := image.Decode(bytes.NewReader(logoData))
if err != nil {
return nil, err
}
googleData, err := googlePngBytes()
if err != nil { if err != nil {
return nil, err return nil, err
} }
google, _, err := image.Decode(bytes.NewReader(googleData)) google, _, err := image.Decode(bytes.NewReader(googleLogo))
if err != nil { if err != nil {
return nil, err return nil, err
} }

@ -6,7 +6,6 @@ require (
eliasnaur.com/font v0.0.0-20200617114307-e02d32decb4b eliasnaur.com/font v0.0.0-20200617114307-e02d32decb4b
gioui.org v0.0.0-20210623091900-5b8da35a798b gioui.org v0.0.0-20210623091900-5b8da35a798b
gioui.org/cmd v0.0.0-20210623091900-5b8da35a798b gioui.org/cmd v0.0.0-20210623091900-5b8da35a798b
github.com/go-bindata/go-bindata v3.1.2+incompatible
golang.org/x/exp v0.0.0-20191227195350-da58074b4299 golang.org/x/exp v0.0.0-20191227195350-da58074b4299
golang.org/x/sys v0.0.0-20210616094352-59db8d763f22 golang.org/x/sys v0.0.0-20210616094352-59db8d763f22
golang.zx2c4.com/wireguard v0.0.0-20210525143454-64cb82f2b3f5 golang.zx2c4.com/wireguard v0.0.0-20210525143454-64cb82f2b3f5

@ -105,8 +105,6 @@ github.com/github/fakeca v0.1.0 h1:Km/MVOFvclqxPM9dZBC4+QE564nU4gz4iZ0D9pMw28I=
github.com/github/fakeca v0.1.0/go.mod h1:+bormgoGMMuamOscx7N91aOuUST7wdaJ2rNjeohylyo= github.com/github/fakeca v0.1.0/go.mod h1:+bormgoGMMuamOscx7N91aOuUST7wdaJ2rNjeohylyo=
github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0=
github.com/gliderlabs/ssh v0.3.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= github.com/gliderlabs/ssh v0.3.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0=
github.com/go-bindata/go-bindata v3.1.2+incompatible h1:5vjJMVhowQdPzjE1LdxyFF7YFTXg5IgGVW4gBr5IbvE=
github.com/go-bindata/go-bindata v3.1.2+incompatible/go.mod h1:xK8Dsgwmeed+BBsSy2XTopBn/8uK2HWuGSnA11C3Joo=
github.com/go-critic/go-critic v0.5.2/go.mod h1:cc0+HvdE3lFpqLecgqMaJcvWWH77sLdBp+wLGPM1Yyo= github.com/go-critic/go-critic v0.5.2/go.mod h1:cc0+HvdE3lFpqLecgqMaJcvWWH77sLdBp+wLGPM1Yyo=
github.com/go-git/gcfg v1.5.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E= github.com/go-git/gcfg v1.5.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E=
github.com/go-git/go-billy/v5 v5.0.0/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0= github.com/go-git/go-billy/v5 v5.0.0/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0=

Loading…
Cancel
Save