From c42bec118e6126789fed261ec7bdbd6ec216aee4 Mon Sep 17 00:00:00 2001 From: Michael Marineau Date: Mon, 5 Jun 2017 14:12:07 -0700 Subject: [PATCH] client: support runtime changes of app id --- omaha/client/client.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/omaha/client/client.go b/omaha/client/client.go index a4a6fc6..106a384 100644 --- a/omaha/client/client.go +++ b/omaha/client/client.go @@ -155,6 +155,21 @@ func NewAppClient(serverURL, userID, appID, appVersion string) (*AppClient, erro return ac, nil } +func (ac *AppClient) SetAppID(appID string) error { + if appID == ac.appID { + return nil + } + + if _, ok := ac.apps[appID]; ok { + return fmt.Errorf("omaha: duplicate app %q", appID) + } + + delete(ac.apps, ac.appID) + ac.appID = appID + ac.apps[appID] = ac + return nil +} + // SetVersion changes the application version. func (ac *AppClient) SetVersion(version string) error { if version == "" {