diff --git a/.vscode/launch.json b/.vscode/launch.json index 91b425d..bb76b91 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -3,5 +3,24 @@ // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", - "configurations": [] + "configurations": [ + { + // dlv debug --headless --listen localhost:2345 --api-version 2 --build-flags "-ldflags='-H windowsgui'" + "name": "Connect to server", + "type": "go", + "request": "attach", + "mode": "remote", + "remotePath": "${workspaceFolder}", + "port": 2345, + "host": "127.0.0.1" + }, + { + "name": "Launch Package", + "type": "go", + "request": "launch", + "buildFlags": "-ldflags='-H windowsgui'", + "mode": "auto", + "program": "${workspaceFolder}" + } + ] } \ No newline at end of file diff --git a/go.mod b/go.mod index a8d1af1..4c79230 100644 --- a/go.mod +++ b/go.mod @@ -7,6 +7,7 @@ require ( github.com/google/uuid v1.3.0 github.com/lxn/walk v0.0.0-20210112085537-c389da54e794 github.com/rhysd/go-github-selfupdate v1.2.3 + github.com/sirupsen/logrus v1.8.1 github.com/tidwall/jsonc v0.3.2 golang.org/x/sys v0.0.0-20220114195835-da31bd327af9 gotest.tools v2.2.0+incompatible @@ -20,7 +21,6 @@ require ( github.com/inconshreveable/go-update v0.0.0-20160112193335-8152e7eb6ccf // indirect github.com/lxn/win v0.0.0-20210218163916-a377121e959e // indirect github.com/pkg/errors v0.9.1 // indirect - github.com/sirupsen/logrus v1.8.1 // indirect github.com/tcnksm/go-gitconfig v0.1.2 // indirect github.com/ulikunitz/xz v0.5.9 // indirect golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad // indirect @@ -30,3 +30,5 @@ require ( gopkg.in/Knetic/govaluate.v3 v3.0.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect ) + +replace github.com/rhysd/go-github-selfupdate v1.2.3 => github.com/stuartleeks/go-github-selfupdate v1.2.4 diff --git a/go.sum b/go.sum index 9bf4a0b..89842b8 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,6 @@ github.com/blang/semver v3.5.1+incompatible h1:cQNTCjp13qL8KC3Nbxr/y2Bqb63oX6wdnnjpJbkM4JQ= github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -28,12 +29,14 @@ github.com/onsi/gomega v1.4.2 h1:3mYCb7aPxS/RU7TI1y4rkEn1oKmPRjNJLNEXgw7MH2I= github.com/onsi/gomega v1.4.2/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rhysd/go-github-selfupdate v1.2.3 h1:iaa+J202f+Nc+A8zi75uccC8Wg3omaM7HDeimXA22Ag= -github.com/rhysd/go-github-selfupdate v1.2.3/go.mod h1:mp/N8zj6jFfBQy/XMYoWsmfzxazpPAODuqarmPDe2Rg= github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= +github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stuartleeks/go-github-selfupdate v1.2.4 h1:NouxmmBBSSZNK7SG+16YGqqYMYGADJxCVzk6BwuS/l0= +github.com/stuartleeks/go-github-selfupdate v1.2.4/go.mod h1:mp/N8zj6jFfBQy/XMYoWsmfzxazpPAODuqarmPDe2Rg= github.com/tcnksm/go-gitconfig v0.1.2 h1:iiDhRitByXAEyjgBqsKi9QU4o2TNtv9kPP3RgPgXBPw= github.com/tcnksm/go-gitconfig v0.1.2/go.mod h1:/8EhP4H7oJZdIPyT+/UIsG87kTzrzM4UsLGSItWYCpE= github.com/tidwall/jsonc v0.3.2 h1:ZTKrmejRlAJYdn0kcaFqRAKlxxFIC21pYq8vLa4p2Wc= diff --git a/main.go b/main.go index 2bf1ed0..8ebe691 100644 --- a/main.go +++ b/main.go @@ -149,7 +149,7 @@ func PerformUpdateCheck(settings *config.Settings) error { if err != nil { return fmt.Errorf("failed to locate executable:\n%s", err) } - if err := selfupdate.UpdateTo(latest.AssetURL, exe); err != nil { + if err := selfupdate.NoGitUpdater().UpdateTo(latest, exe); err != nil { return fmt.Errorf("failed to perform update:\n%s", err) } diff --git a/update.go b/update.go index afedc0a..a71a026 100644 --- a/update.go +++ b/update.go @@ -43,7 +43,7 @@ func HandleUpdate() error { if err != nil { return fmt.Errorf("could not locate executable path: %v", err) } - if err := selfupdate.UpdateTo(latest.AssetURL, exe); err != nil { + if err := selfupdate.NoGitUpdater().UpdateTo(latest, exe); err != nil { return fmt.Errorf("error occurred while updating binary: %v", err) } fmt.Printf("Successfully updated to version %s\n", latest.Version) @@ -53,7 +53,7 @@ func HandleUpdate() error { func CheckForUpdate(currentVersion string) (*selfupdate.Release, error) { - latest, found, err := selfupdate.DetectLatest("stuartleeks/pick-a-browser") + latest, found, err := selfupdate.NoGitUpdater().DetectLatest("stuartleeks/pick-a-browser") if err != nil { return nil, fmt.Errorf("error occurred while detecting version: %v", err) }