From 233515e86a77ce88edeb5cc7b7ad2c3c8d51479f Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Fri, 18 Sep 2020 10:16:47 +0200 Subject: [PATCH] cmd/tailscale: move the App.appDir field to the only method that uses it Signed-off-by: Elias Naur --- cmd/tailscale/main.go | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/cmd/tailscale/main.go b/cmd/tailscale/main.go index aa83275..6a260c9 100644 --- a/cmd/tailscale/main.go +++ b/cmd/tailscale/main.go @@ -29,7 +29,6 @@ import ( type App struct { jvm jni.JVM appCtx jni.Object - appDir string store *stateStore // updates is notifies whenever netState or browseURL changes. @@ -112,11 +111,6 @@ func main() { updates: make(chan struct{}, 1), vpnClosed: make(chan struct{}, 1), } - appDir, err := app.DataDir() - if err != nil { - fatalErr(err) - } - a.appDir = appDir a.store = newStateStore(a.jvm, a.appCtx) go func() { if err := a.runBackend(); err != nil { @@ -132,9 +126,13 @@ func main() { } func (a *App) runBackend() error { + appDir, err := app.DataDir() + if err != nil { + fatalErr(err) + } configs := make(chan *router.Config) configErrs := make(chan error) - b, err := newBackend(a.appDir, a.jvm, a.store, func(s *router.Config) error { + b, err := newBackend(appDir, a.jvm, a.store, func(s *router.Config) error { if s == nil { return nil }