Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
118 changes: 71 additions & 47 deletions NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,24 @@ Copyright (c) Codesphere Inc.

This project includes code licensed under the following terms:

----------
Module: code.gitea.io/sdk/gitea
Version: v0.22.1
License: MIT
License URL: https://gitea.com/gitea/go-sdk/src/tag/gitea/v0.22.1/gitea/LICENSE

----------
Module: dario.cat/mergo
Version: v1.0.2
License: BSD-3-Clause
License URL: https://github.com/imdario/mergo/blob/v1.0.2/LICENSE

----------
Module: github.com/42wim/httpsig
Version: v1.2.3
License: BSD-3-Clause
License URL: https://github.com/42wim/httpsig/blob/v1.2.3/LICENSE

----------
Module: github.com/Masterminds/semver/v3
Version: v3.4.0
Expand All @@ -27,12 +39,6 @@ Version: v1.0.1
License: MIT
License URL: https://github.com/beorn7/perks/blob/v1.0.1/LICENSE

----------
Module: github.com/blang/semver
Version: v3.5.1
License: MIT
License URL: https://github.com/blang/semver/blob/v3.5.1/LICENSE

----------
Module: github.com/cespare/xxhash/v2
Version: v2.3.0
Expand Down Expand Up @@ -69,6 +75,18 @@ Version: v2.0.7
License: MIT
License URL: https://github.com/cpuguy83/go-md2man/blob/v2.0.7/LICENSE.md

----------
Module: github.com/creativeprojects/go-selfupdate
Version: v1.5.2
License: MIT
License URL: https://github.com/creativeprojects/go-selfupdate/blob/v1.5.2/LICENSE

----------
Module: github.com/creativeprojects/go-selfupdate/update
Version: v1.5.2
License: Apache-2.0
License URL: https://github.com/creativeprojects/go-selfupdate/blob/v1.5.2/update/LICENSE

----------
Module: github.com/cyphar/filepath-securejoin
Version: v0.6.1
Expand All @@ -93,6 +111,12 @@ Version: v2.9.0
License: MIT
License URL: https://github.com/fxamacker/cbor/blob/v2.9.0/LICENSE

----------
Module: github.com/go-fed/httpsig
Version: v1.1.0
License: BSD-3-Clause
License URL: https://github.com/go-fed/httpsig/blob/v1.1.0/LICENSE

----------
Module: github.com/go-git/gcfg
Version: v1.5.1-0.20230307220236-3a3c6141e376
Expand Down Expand Up @@ -130,10 +154,10 @@ License: BSD-3-Clause
License URL: https://github.com/google/go-cmp/blob/v0.7.0/LICENSE

----------
Module: github.com/google/go-github/v30/github
Version: v30.1.0
Module: github.com/google/go-github/v74/github
Version: v74.0.0
License: BSD-3-Clause
License URL: https://github.com/google/go-github/blob/v30.1.0/LICENSE
License URL: https://github.com/google/go-github/blob/v74.0.0/LICENSE

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

----------
Module: github.com/inconshreveable/go-update
Version: v0.0.0-20160112193335-8152e7eb6ccf
License: Apache-2.0
License URL: https://github.com/inconshreveable/go-update/blob/8152e7eb6ccf/LICENSE
Module: github.com/hashicorp/go-cleanhttp
Version: v0.5.2
License: MPL-2.0
License URL: https://github.com/hashicorp/go-cleanhttp/blob/v0.5.2/LICENSE

----------
Module: github.com/inconshreveable/go-update/internal/binarydist
Version: v0.0.0-20160112193335-8152e7eb6ccf
License: MIT
License URL: https://github.com/inconshreveable/go-update/blob/8152e7eb6ccf/internal/binarydist/License
Module: github.com/hashicorp/go-retryablehttp
Version: v0.7.8
License: MPL-2.0
License URL: https://github.com/hashicorp/go-retryablehttp/blob/v0.7.8/LICENSE

----------
Module: github.com/inconshreveable/go-update/internal/osext
Version: v0.0.0-20160112193335-8152e7eb6ccf
License: BSD-3-Clause
License URL: https://github.com/inconshreveable/go-update/blob/8152e7eb6ccf/internal/osext/LICENSE
Module: github.com/hashicorp/go-version
Version: v1.8.0
License: MPL-2.0
License URL: https://github.com/hashicorp/go-version/blob/v1.8.0/LICENSE

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

----------
Module: github.com/onsi/ginkgo/v2
Version: v2.27.5
Version: v2.28.1
License: MIT
License URL: https://github.com/onsi/ginkgo/blob/v2.27.5/LICENSE
License URL: https://github.com/onsi/ginkgo/blob/v2.28.1/LICENSE

----------
Module: github.com/onsi/gomega
Version: v1.39.0
Version: v1.39.1
License: MIT
License URL: https://github.com/onsi/gomega/blob/v1.39.0/LICENSE
License URL: https://github.com/onsi/gomega/blob/v1.39.1/LICENSE

----------
Module: github.com/pjbgf/sha1cd
Expand Down Expand Up @@ -279,12 +303,6 @@ Version: v0.19.2
License: Apache-2.0
License URL: https://github.com/prometheus/procfs/blob/v0.19.2/LICENSE

----------
Module: github.com/rhysd/go-github-selfupdate/selfupdate
Version: v1.2.3
License: MIT
License URL: https://github.com/rhysd/go-github-selfupdate/blob/v1.2.3/LICENSE

----------
Module: github.com/russross/blackfriday/v2
Version: v2.1.0
Expand Down Expand Up @@ -327,12 +345,6 @@ Version: v1.11.1
License: MIT
License URL: https://github.com/stretchr/testify/blob/v1.11.1/LICENSE

----------
Module: github.com/tcnksm/go-gitconfig
Version: v0.1.2
License: MIT
License URL: https://github.com/tcnksm/go-gitconfig/blob/v0.1.2/LICENSE

----------
Module: github.com/ulikunitz/xz
Version: v0.5.15
Expand All @@ -351,6 +363,12 @@ Version: v0.3.3
License: Apache-2.0
License URL: https://github.com/xanzy/ssh-agent/blob/v0.3.3/LICENSE

----------
Module: gitlab.com/gitlab-org/api/client-go
Version: v1.11.0
License: Apache-2.0
License URL: https://gitlab.com/gitlab-org/api/blob/client-go/v1.11.0/client-go/LICENSE

----------
Module: go.yaml.in/yaml/v2
Version: v2.4.3
Expand All @@ -365,21 +383,21 @@ License URL: https://github.com/yaml/go-yaml/blob/v3.0.4/LICENSE

----------
Module: golang.org/x/crypto
Version: v0.46.0
Version: v0.47.0
License: BSD-3-Clause
License URL: https://cs.opensource.google/go/x/crypto/+/v0.46.0:LICENSE
License URL: https://cs.opensource.google/go/x/crypto/+/v0.47.0:LICENSE

----------
Module: golang.org/x/mod/semver
Version: v0.31.0
Version: v0.32.0
License: BSD-3-Clause
License URL: https://cs.opensource.google/go/x/mod/+/v0.31.0:LICENSE
License URL: https://cs.opensource.google/go/x/mod/+/v0.32.0:LICENSE

----------
Module: golang.org/x/net
Version: v0.48.0
Version: v0.49.0
License: BSD-3-Clause
License URL: https://cs.opensource.google/go/x/net/+/v0.48.0:LICENSE
License URL: https://cs.opensource.google/go/x/net/+/v0.49.0:LICENSE

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

----------
Module: golang.org/x/text
Version: v0.32.0
Version: v0.33.0
License: BSD-3-Clause
License URL: https://cs.opensource.google/go/x/text/+/v0.32.0:LICENSE
License URL: https://cs.opensource.google/go/x/text/+/v0.33.0:LICENSE

----------
Module: golang.org/x/time/rate
Version: v0.14.0
License: BSD-3-Clause
License URL: https://cs.opensource.google/go/x/time/+/v0.14.0:LICENSE

----------
Module: golang.org/x/tools
Version: v0.40.0
Version: v0.41.0
License: BSD-3-Clause
License URL: https://cs.opensource.google/go/x/tools/+/v0.40.0:LICENSE
License URL: https://cs.opensource.google/go/x/tools/+/v0.41.0:LICENSE

----------
Module: google.golang.org/protobuf
Expand Down
17 changes: 9 additions & 8 deletions cli/cmd/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
package cmd

import (
"context"
"fmt"
"log"

"github.com/blang/semver"
"github.com/rhysd/go-github-selfupdate/selfupdate"
"github.com/creativeprojects/go-selfupdate"
"github.com/spf13/cobra"

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

func SelfUpdate() error {
v := semver.MustParse(cs.Version())
latest, err := selfupdate.UpdateSelf(v, "codesphere-cloud/cs-go")
currentVersion := cs.Version()
latest, err := selfupdate.UpdateSelf(context.Background(), currentVersion, selfupdate.ParseSlug("codesphere-cloud/cs-go"))
if err != nil {
return fmt.Errorf("update failed: %w", err)
}
if latest.Version.Equals(v) {
fmt.Println("Current cs CLI is the latest version", cs.Version())
if latest.LessOrEqual(currentVersion) {
log.Println("Current cs CLI is the latest version", currentVersion)
return nil
}
fmt.Println("Successfully updated to version", latest.Version)
fmt.Println("Release notes:\n", latest.ReleaseNotes)
log.Println("Successfully updated to version", latest.Version())
log.Println("Release notes:\n", latest.ReleaseNotes)
return nil
}
8 changes: 3 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@ module github.com/codesphere-cloud/cs-go
go 1.25.5

require (
github.com/blang/semver v3.5.1+incompatible
github.com/creativeprojects/go-selfupdate v1.5.2
github.com/go-git/go-billy/v5 v5.7.0
github.com/go-git/go-git/v5 v5.16.4
github.com/jedib0t/go-pretty/v6 v6.7.8
github.com/onsi/ginkgo/v2 v2.28.1
github.com/onsi/gomega v1.39.1
github.com/prometheus/client_golang v1.23.2
github.com/rhysd/go-github-selfupdate v1.2.3
github.com/spf13/cobra v1.10.2
github.com/stretchr/testify v1.11.1
go.yaml.in/yaml/v3 v3.0.4
Expand Down Expand Up @@ -121,6 +120,7 @@ require (
github.com/blacktop/go-dwarf v1.0.14 // indirect
github.com/blacktop/go-macho v1.1.259 // indirect
github.com/blakesmith/ar v0.0.0-20190502131153-809d4375e1fb // indirect
github.com/blang/semver v3.5.1+incompatible // indirect
github.com/blizzy78/varnamelen v0.8.0 // indirect
github.com/bluesky-social/indigo v0.0.0-20260106221649-6fcd9317e725 // indirect
github.com/bombsimon/wsl/v4 v4.7.0 // indirect
Expand Down Expand Up @@ -254,6 +254,7 @@ require (
github.com/golangci/unconvert v0.0.0-20250410112200-a129a6e6413e // indirect
github.com/google/certificate-transparency-go v1.3.2 // indirect
github.com/google/go-containerregistry v0.20.7 // indirect
github.com/google/go-github/v74 v74.0.0 // indirect
github.com/google/go-github/v80 v80.0.0 // indirect
github.com/google/ko v0.18.1 // indirect
github.com/google/rpmpack v0.7.1 // indirect
Expand Down Expand Up @@ -520,10 +521,8 @@ require (
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect
github.com/google/go-cmp v0.7.0 // indirect
github.com/google/go-github/v30 v30.1.0 // indirect
github.com/google/go-querystring v1.2.0 // indirect
github.com/google/pprof v0.0.0-20260115054156-294ebfa9ad83 // indirect
github.com/inconshreveable/go-update v0.0.0-20160112193335-8152e7eb6ccf // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/kevinburke/ssh_config v1.4.0 // indirect
Expand All @@ -539,7 +538,6 @@ require (
github.com/skeema/knownhosts v1.3.2 // indirect
github.com/spf13/pflag v1.0.10 // indirect
github.com/stretchr/objx v0.5.3 // indirect
github.com/tcnksm/go-gitconfig v0.1.2 // indirect
github.com/ulikunitz/xz v0.5.15 // indirect
github.com/xanzy/ssh-agent v0.3.3 // indirect
golang.org/x/crypto v0.47.0 // indirect
Expand Down
Loading