Skip to content

Commit 1844a6a

Browse files
ref: replace unmaintained selfupdate library with creativeprojects/go-selfupdate (#165)
* ref: replace unmaintained selfupdate library with creativeprojects/go-selfupdate * chore(docs): Auto-update docs and licenses Signed-off-by: OliverTrautvetter <66372584+OliverTrautvetter@users.noreply.github.com> --------- Signed-off-by: OliverTrautvetter <66372584+OliverTrautvetter@users.noreply.github.com>
1 parent c070361 commit 1844a6a

File tree

5 files changed

+158
-137
lines changed

5 files changed

+158
-137
lines changed

NOTICE

Lines changed: 71 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,24 @@ Copyright (c) Codesphere Inc.
33

44
This project includes code licensed under the following terms:
55

6+
----------
7+
Module: code.gitea.io/sdk/gitea
8+
Version: v0.22.1
9+
License: MIT
10+
License URL: https://gitea.com/gitea/go-sdk/src/tag/gitea/v0.22.1/gitea/LICENSE
11+
612
----------
713
Module: dario.cat/mergo
814
Version: v1.0.2
915
License: BSD-3-Clause
1016
License URL: https://github.com/imdario/mergo/blob/v1.0.2/LICENSE
1117

18+
----------
19+
Module: github.com/42wim/httpsig
20+
Version: v1.2.3
21+
License: BSD-3-Clause
22+
License URL: https://github.com/42wim/httpsig/blob/v1.2.3/LICENSE
23+
1224
----------
1325
Module: github.com/Masterminds/semver/v3
1426
Version: v3.4.0
@@ -27,12 +39,6 @@ Version: v1.0.1
2739
License: MIT
2840
License URL: https://github.com/beorn7/perks/blob/v1.0.1/LICENSE
2941

30-
----------
31-
Module: github.com/blang/semver
32-
Version: v3.5.1
33-
License: MIT
34-
License URL: https://github.com/blang/semver/blob/v3.5.1/LICENSE
35-
3642
----------
3743
Module: github.com/cespare/xxhash/v2
3844
Version: v2.3.0
@@ -69,6 +75,18 @@ Version: v2.0.7
6975
License: MIT
7076
License URL: https://github.com/cpuguy83/go-md2man/blob/v2.0.7/LICENSE.md
7177

78+
----------
79+
Module: github.com/creativeprojects/go-selfupdate
80+
Version: v1.5.2
81+
License: MIT
82+
License URL: https://github.com/creativeprojects/go-selfupdate/blob/v1.5.2/LICENSE
83+
84+
----------
85+
Module: github.com/creativeprojects/go-selfupdate/update
86+
Version: v1.5.2
87+
License: Apache-2.0
88+
License URL: https://github.com/creativeprojects/go-selfupdate/blob/v1.5.2/update/LICENSE
89+
7290
----------
7391
Module: github.com/cyphar/filepath-securejoin
7492
Version: v0.6.1
@@ -93,6 +111,12 @@ Version: v2.9.0
93111
License: MIT
94112
License URL: https://github.com/fxamacker/cbor/blob/v2.9.0/LICENSE
95113

114+
----------
115+
Module: github.com/go-fed/httpsig
116+
Version: v1.1.0
117+
License: BSD-3-Clause
118+
License URL: https://github.com/go-fed/httpsig/blob/v1.1.0/LICENSE
119+
96120
----------
97121
Module: github.com/go-git/gcfg
98122
Version: v1.5.1-0.20230307220236-3a3c6141e376
@@ -130,10 +154,10 @@ License: BSD-3-Clause
130154
License URL: https://github.com/google/go-cmp/blob/v0.7.0/LICENSE
131155

132156
----------
133-
Module: github.com/google/go-github/v30/github
134-
Version: v30.1.0
157+
Module: github.com/google/go-github/v74/github
158+
Version: v74.0.0
135159
License: BSD-3-Clause
136-
License URL: https://github.com/google/go-github/blob/v30.1.0/LICENSE
160+
License URL: https://github.com/google/go-github/blob/v74.0.0/LICENSE
137161

138162
----------
139163
Module: github.com/google/go-querystring/query
@@ -142,22 +166,22 @@ License: BSD-3-Clause
142166
License URL: https://github.com/google/go-querystring/blob/v1.2.0/LICENSE
143167

144168
----------
145-
Module: github.com/inconshreveable/go-update
146-
Version: v0.0.0-20160112193335-8152e7eb6ccf
147-
License: Apache-2.0
148-
License URL: https://github.com/inconshreveable/go-update/blob/8152e7eb6ccf/LICENSE
169+
Module: github.com/hashicorp/go-cleanhttp
170+
Version: v0.5.2
171+
License: MPL-2.0
172+
License URL: https://github.com/hashicorp/go-cleanhttp/blob/v0.5.2/LICENSE
149173

150174
----------
151-
Module: github.com/inconshreveable/go-update/internal/binarydist
152-
Version: v0.0.0-20160112193335-8152e7eb6ccf
153-
License: MIT
154-
License URL: https://github.com/inconshreveable/go-update/blob/8152e7eb6ccf/internal/binarydist/License
175+
Module: github.com/hashicorp/go-retryablehttp
176+
Version: v0.7.8
177+
License: MPL-2.0
178+
License URL: https://github.com/hashicorp/go-retryablehttp/blob/v0.7.8/LICENSE
155179

156180
----------
157-
Module: github.com/inconshreveable/go-update/internal/osext
158-
Version: v0.0.0-20160112193335-8152e7eb6ccf
159-
License: BSD-3-Clause
160-
License URL: https://github.com/inconshreveable/go-update/blob/8152e7eb6ccf/internal/osext/LICENSE
181+
Module: github.com/hashicorp/go-version
182+
Version: v1.8.0
183+
License: MPL-2.0
184+
License URL: https://github.com/hashicorp/go-version/blob/v1.8.0/LICENSE
161185

162186
----------
163187
Module: github.com/jbenet/go-context/io
@@ -227,15 +251,15 @@ License URL: https://github.com/munnerz/goautoneg/blob/a7dc8b61c822/LICENSE
227251

228252
----------
229253
Module: github.com/onsi/ginkgo/v2
230-
Version: v2.27.5
254+
Version: v2.28.1
231255
License: MIT
232-
License URL: https://github.com/onsi/ginkgo/blob/v2.27.5/LICENSE
256+
License URL: https://github.com/onsi/ginkgo/blob/v2.28.1/LICENSE
233257

234258
----------
235259
Module: github.com/onsi/gomega
236-
Version: v1.39.0
260+
Version: v1.39.1
237261
License: MIT
238-
License URL: https://github.com/onsi/gomega/blob/v1.39.0/LICENSE
262+
License URL: https://github.com/onsi/gomega/blob/v1.39.1/LICENSE
239263

240264
----------
241265
Module: github.com/pjbgf/sha1cd
@@ -279,12 +303,6 @@ Version: v0.19.2
279303
License: Apache-2.0
280304
License URL: https://github.com/prometheus/procfs/blob/v0.19.2/LICENSE
281305

282-
----------
283-
Module: github.com/rhysd/go-github-selfupdate/selfupdate
284-
Version: v1.2.3
285-
License: MIT
286-
License URL: https://github.com/rhysd/go-github-selfupdate/blob/v1.2.3/LICENSE
287-
288306
----------
289307
Module: github.com/russross/blackfriday/v2
290308
Version: v2.1.0
@@ -327,12 +345,6 @@ Version: v1.11.1
327345
License: MIT
328346
License URL: https://github.com/stretchr/testify/blob/v1.11.1/LICENSE
329347

330-
----------
331-
Module: github.com/tcnksm/go-gitconfig
332-
Version: v0.1.2
333-
License: MIT
334-
License URL: https://github.com/tcnksm/go-gitconfig/blob/v0.1.2/LICENSE
335-
336348
----------
337349
Module: github.com/ulikunitz/xz
338350
Version: v0.5.15
@@ -351,6 +363,12 @@ Version: v0.3.3
351363
License: Apache-2.0
352364
License URL: https://github.com/xanzy/ssh-agent/blob/v0.3.3/LICENSE
353365

366+
----------
367+
Module: gitlab.com/gitlab-org/api/client-go
368+
Version: v1.11.0
369+
License: Apache-2.0
370+
License URL: https://gitlab.com/gitlab-org/api/blob/client-go/v1.11.0/client-go/LICENSE
371+
354372
----------
355373
Module: go.yaml.in/yaml/v2
356374
Version: v2.4.3
@@ -365,21 +383,21 @@ License URL: https://github.com/yaml/go-yaml/blob/v3.0.4/LICENSE
365383

366384
----------
367385
Module: golang.org/x/crypto
368-
Version: v0.46.0
386+
Version: v0.47.0
369387
License: BSD-3-Clause
370-
License URL: https://cs.opensource.google/go/x/crypto/+/v0.46.0:LICENSE
388+
License URL: https://cs.opensource.google/go/x/crypto/+/v0.47.0:LICENSE
371389

372390
----------
373391
Module: golang.org/x/mod/semver
374-
Version: v0.31.0
392+
Version: v0.32.0
375393
License: BSD-3-Clause
376-
License URL: https://cs.opensource.google/go/x/mod/+/v0.31.0:LICENSE
394+
License URL: https://cs.opensource.google/go/x/mod/+/v0.32.0:LICENSE
377395

378396
----------
379397
Module: golang.org/x/net
380-
Version: v0.48.0
398+
Version: v0.49.0
381399
License: BSD-3-Clause
382-
License URL: https://cs.opensource.google/go/x/net/+/v0.48.0:LICENSE
400+
License URL: https://cs.opensource.google/go/x/net/+/v0.49.0:LICENSE
383401

384402
----------
385403
Module: golang.org/x/oauth2
@@ -401,15 +419,21 @@ License URL: https://cs.opensource.google/go/x/sys/+/v0.40.0:LICENSE
401419

402420
----------
403421
Module: golang.org/x/text
404-
Version: v0.32.0
422+
Version: v0.33.0
405423
License: BSD-3-Clause
406-
License URL: https://cs.opensource.google/go/x/text/+/v0.32.0:LICENSE
424+
License URL: https://cs.opensource.google/go/x/text/+/v0.33.0:LICENSE
425+
426+
----------
427+
Module: golang.org/x/time/rate
428+
Version: v0.14.0
429+
License: BSD-3-Clause
430+
License URL: https://cs.opensource.google/go/x/time/+/v0.14.0:LICENSE
407431

408432
----------
409433
Module: golang.org/x/tools
410-
Version: v0.40.0
434+
Version: v0.41.0
411435
License: BSD-3-Clause
412-
License URL: https://cs.opensource.google/go/x/tools/+/v0.40.0:LICENSE
436+
License URL: https://cs.opensource.google/go/x/tools/+/v0.41.0:LICENSE
413437

414438
----------
415439
Module: google.golang.org/protobuf

cli/cmd/update.go

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44
package cmd
55

66
import (
7+
"context"
78
"fmt"
9+
"log"
810

9-
"github.com/blang/semver"
10-
"github.com/rhysd/go-github-selfupdate/selfupdate"
11+
"github.com/creativeprojects/go-selfupdate"
1112
"github.com/spf13/cobra"
1213

1314
"github.com/codesphere-cloud/cs-go/pkg/cs"
@@ -35,16 +36,16 @@ func AddUpdateCmd(rootCmd *cobra.Command) {
3536
}
3637

3738
func SelfUpdate() error {
38-
v := semver.MustParse(cs.Version())
39-
latest, err := selfupdate.UpdateSelf(v, "codesphere-cloud/cs-go")
39+
currentVersion := cs.Version()
40+
latest, err := selfupdate.UpdateSelf(context.Background(), currentVersion, selfupdate.ParseSlug("codesphere-cloud/cs-go"))
4041
if err != nil {
4142
return fmt.Errorf("update failed: %w", err)
4243
}
43-
if latest.Version.Equals(v) {
44-
fmt.Println("Current cs CLI is the latest version", cs.Version())
44+
if latest.LessOrEqual(currentVersion) {
45+
log.Println("Current cs CLI is the latest version", currentVersion)
4546
return nil
4647
}
47-
fmt.Println("Successfully updated to version", latest.Version)
48-
fmt.Println("Release notes:\n", latest.ReleaseNotes)
48+
log.Println("Successfully updated to version", latest.Version())
49+
log.Println("Release notes:\n", latest.ReleaseNotes)
4950
return nil
5051
}

go.mod

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@ module github.com/codesphere-cloud/cs-go
33
go 1.25.5
44

55
require (
6-
github.com/blang/semver v3.5.1+incompatible
6+
github.com/creativeprojects/go-selfupdate v1.5.2
77
github.com/go-git/go-billy/v5 v5.7.0
88
github.com/go-git/go-git/v5 v5.16.4
99
github.com/jedib0t/go-pretty/v6 v6.7.8
1010
github.com/onsi/ginkgo/v2 v2.28.1
1111
github.com/onsi/gomega v1.39.1
1212
github.com/prometheus/client_golang v1.23.2
13-
github.com/rhysd/go-github-selfupdate v1.2.3
1413
github.com/spf13/cobra v1.10.2
1514
github.com/stretchr/testify v1.11.1
1615
go.yaml.in/yaml/v3 v3.0.4
@@ -121,6 +120,7 @@ require (
121120
github.com/blacktop/go-dwarf v1.0.14 // indirect
122121
github.com/blacktop/go-macho v1.1.259 // indirect
123122
github.com/blakesmith/ar v0.0.0-20190502131153-809d4375e1fb // indirect
123+
github.com/blang/semver v3.5.1+incompatible // indirect
124124
github.com/blizzy78/varnamelen v0.8.0 // indirect
125125
github.com/bluesky-social/indigo v0.0.0-20260106221649-6fcd9317e725 // indirect
126126
github.com/bombsimon/wsl/v4 v4.7.0 // indirect
@@ -254,6 +254,7 @@ require (
254254
github.com/golangci/unconvert v0.0.0-20250410112200-a129a6e6413e // indirect
255255
github.com/google/certificate-transparency-go v1.3.2 // indirect
256256
github.com/google/go-containerregistry v0.20.7 // indirect
257+
github.com/google/go-github/v74 v74.0.0 // indirect
257258
github.com/google/go-github/v80 v80.0.0 // indirect
258259
github.com/google/ko v0.18.1 // indirect
259260
github.com/google/rpmpack v0.7.1 // indirect
@@ -520,10 +521,8 @@ require (
520521
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
521522
github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect
522523
github.com/google/go-cmp v0.7.0 // indirect
523-
github.com/google/go-github/v30 v30.1.0 // indirect
524524
github.com/google/go-querystring v1.2.0 // indirect
525525
github.com/google/pprof v0.0.0-20260115054156-294ebfa9ad83 // indirect
526-
github.com/inconshreveable/go-update v0.0.0-20160112193335-8152e7eb6ccf // indirect
527526
github.com/inconshreveable/mousetrap v1.1.0 // indirect
528527
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
529528
github.com/kevinburke/ssh_config v1.4.0 // indirect
@@ -539,7 +538,6 @@ require (
539538
github.com/skeema/knownhosts v1.3.2 // indirect
540539
github.com/spf13/pflag v1.0.10 // indirect
541540
github.com/stretchr/objx v0.5.3 // indirect
542-
github.com/tcnksm/go-gitconfig v0.1.2 // indirect
543541
github.com/ulikunitz/xz v0.5.15 // indirect
544542
github.com/xanzy/ssh-agent v0.3.3 // indirect
545543
golang.org/x/crypto v0.47.0 // indirect

0 commit comments

Comments
 (0)