Skip to content

Commit 1026d94

Browse files
authored
Merge branch 'main' into ale-fix-create-path-regression
2 parents 8c6c53b + bd6a088 commit 1026d94

9 files changed

Lines changed: 44 additions & 30 deletions

File tree

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ jobs:
113113
default: "dev-build"
114114
docker: # run the steps with Docker
115115
# CircleCI Go images available at: https://hub.docker.com/r/circleci/golang/
116-
- image: cimg/go:1.26.2
116+
- image: cimg/go:1.26.3
117117
steps: # steps that comprise the `build` job
118118
- checkout # check out source code to working directory
119119
- restore_cache: # restores saved cache if no changes are detected since last run

.github/workflows/tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
- name: Set up Go
2626
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
2727
with:
28-
go-version: "1.26.2"
28+
go-version: "1.26.3"
2929
- name: Lint
3030
run: go tool golangci-lint run --timeout=5m
3131
- name: Unit Tests
@@ -54,7 +54,7 @@ jobs:
5454
- name: Set up Go
5555
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
5656
with:
57-
go-version: "1.26.2"
57+
go-version: "1.26.3"
5858
- name: Report health score
5959
uses: slackapi/slack-health-score@d58a419f15cdaff97e9aa7f09f95772830ab66f7 # v0.1.1
6060
with:

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![tests](https://github.com/slackapi/slack-cli/actions/workflows/tests.yml/badge.svg?branch=main)](https://github.com/slackapi/slack-cli/actions/workflows/tests.yml)
44
[![codecov](https://codecov.io/gh/slackapi/slack-cli/branch/main/graph/badge.svg?token=G5TU59IV9I)](https://codecov.io/gh/slackapi/slack-cli)
5-
[![circleci](https://dl.circleci.com/status-badge/img/gh/slackapi/slack-cli/tree/main.svg?style=svg)](https://dl.circleci.com/status-badge/redirect/gh/slackapi/slack-cli/tree/main)
5+
[![CircleCI](https://dl.circleci.com/status-badge/img/gh/slackapi/slack-cli/tree/main.svg?style=shield&circle-token=CCIPRJ_K7pGxh2PtW5AurUdJTKWpb_2845116e5a6f641726a73654f618e450b0c4e95b)](https://dl.circleci.com/status-badge/redirect/gh/slackapi/slack-cli/tree/main)
66

77
> Command-line interface for building apps on the Slack Platform.
88

go.mod

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/slackapi/slack-cli
22

3-
go 1.26.2
3+
go 1.26.3
44

55
require (
66
charm.land/bubbletea/v2 v2.0.6
@@ -11,7 +11,6 @@ require (
1111
github.com/cli/safeexec v1.0.1
1212
github.com/google/uuid v1.6.0
1313
github.com/gorilla/websocket v1.5.3
14-
github.com/hashicorp/go-version v1.9.0
1514
github.com/joho/godotenv v1.5.1
1615
github.com/kyokomi/emoji/v2 v2.2.13
1716
github.com/logrusorgru/aurora/v4 v4.0.0
@@ -303,12 +302,13 @@ require (
303302
github.com/hashicorp/go-immutable-radix/v2 v2.1.0 // indirect
304303
github.com/hashicorp/go-multierror v1.1.1 // indirect
305304
github.com/hashicorp/go-retryablehttp v0.7.8 // indirect
305+
github.com/hashicorp/go-version v1.9.0 // indirect
306306
github.com/hashicorp/golang-lru v1.0.2 // indirect
307307
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
308308
github.com/hexops/gotextdiff v1.0.3 // indirect
309309
github.com/huandu/xstrings v1.5.0 // indirect
310310
github.com/in-toto/attestation v1.1.2 // indirect
311-
github.com/in-toto/in-toto-golang v0.10.0 // indirect
311+
github.com/in-toto/in-toto-golang v0.11.0 // indirect
312312
github.com/invopop/jsonschema v0.13.0 // indirect
313313
github.com/ipfs/bbloom v0.0.4 // indirect
314314
github.com/ipfs/go-block-format v0.2.0 // indirect

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -773,8 +773,8 @@ github.com/huandu/xstrings v1.5.0 h1:2ag3IFq9ZDANvthTwTiqSSZLjDc+BedvHPAp5tJy2TI
773773
github.com/huandu/xstrings v1.5.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
774774
github.com/in-toto/attestation v1.1.2 h1:MBFn6lsMq6dptQZJBhalXTcWMb/aJy3V+GX3VYj/V1E=
775775
github.com/in-toto/attestation v1.1.2/go.mod h1:gYFddHMZj3DiQ0b62ltNi1Vj5rC879bTmBbrv9CRHpM=
776-
github.com/in-toto/in-toto-golang v0.10.0 h1:+s2eZQSK3WmWfYV85qXVSBfqgawi/5L02MaqA4o/tpM=
777-
github.com/in-toto/in-toto-golang v0.10.0/go.mod h1:wjT4RiyFlLWCmLUJjwB8oZcjaq7HA390aMJcD3xXgmg=
776+
github.com/in-toto/in-toto-golang v0.11.0 h1:nfidMYBFx+E0lnmX5KUnN2Pdm8zdNKal1ayjJuzzRoA=
777+
github.com/in-toto/in-toto-golang v0.11.0/go.mod h1:u3PjTnwFKjp5a1YCcw8SJg0G+tMeKfVoWsWeFMDCMtw=
778778
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
779779
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
780780
github.com/invopop/jsonschema v0.13.0 h1:KvpoAJWEjR3uD9Kbm2HWJmqsEaHt8lBUpd0qHcIi21E=

internal/update/semver.go

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,32 +15,44 @@
1515
package update
1616

1717
import (
18-
"github.com/hashicorp/go-version"
18+
"golang.org/x/mod/semver"
19+
1920
"github.com/slackapi/slack-cli/internal/slackerror"
2021
)
2122

2223
// SemVerGreaterThan returns true if release is greater than current
2324
func SemVerGreaterThan(release string, current string) (bool, error) {
24-
releaseVersion, err := version.NewVersion(release)
25-
if err != nil {
26-
return false, slackerror.New(slackerror.ErrInvalidSemVer).WithRootCause(err)
25+
r := ensureVPrefix(release)
26+
c := ensureVPrefix(current)
27+
if !semver.IsValid(r) {
28+
return false, slackerror.New(slackerror.ErrInvalidSemVer).
29+
WithMessage("Value %s is not a semantic version", release)
2730
}
28-
currentVersion, err := version.NewVersion(current)
29-
if err != nil {
30-
return false, slackerror.New(slackerror.ErrInvalidSemVer).WithRootCause(err)
31+
if !semver.IsValid(c) {
32+
return false, slackerror.New(slackerror.ErrInvalidSemVer).
33+
WithMessage("Value %s is not a semantic version", current)
3134
}
32-
return releaseVersion.GreaterThan(currentVersion), nil
35+
return semver.Compare(r, c) > 0, nil
3336
}
3437

3538
// SemVerLessThan returns true if release is less than current
3639
func SemVerLessThan(release string, current string) (bool, error) {
37-
releaseVersion, err := version.NewVersion(release)
38-
if err != nil {
39-
return false, slackerror.New(slackerror.ErrInvalidSemVer).WithRootCause(err)
40+
r := ensureVPrefix(release)
41+
c := ensureVPrefix(current)
42+
if !semver.IsValid(r) {
43+
return false, slackerror.New(slackerror.ErrInvalidSemVer).
44+
WithMessage("Value %s is not a semantic version", release)
45+
}
46+
if !semver.IsValid(c) {
47+
return false, slackerror.New(slackerror.ErrInvalidSemVer).
48+
WithMessage("Value %s is not a semantic version", current)
4049
}
41-
currentVersion, err := version.NewVersion(current)
42-
if err != nil {
43-
return false, slackerror.New(slackerror.ErrInvalidSemVer).WithRootCause(err)
50+
return semver.Compare(r, c) < 0, nil
51+
}
52+
53+
func ensureVPrefix(v string) string {
54+
if len(v) > 0 && v[0] != 'v' {
55+
return "v" + v
4456
}
45-
return releaseVersion.LessThan(currentVersion), nil
57+
return v
4658
}

scripts/install-dev.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ install_slack_cli() {
166166
if [ "$SLACK_CLI_DEV_VERSION" == "dev" ]; then
167167
delay 0.2 "💾 Successfully downloaded the latest build to $(home_path "$slack_cli_install_dir/slack-cli.tar.gz")"
168168
else
169-
delay 0.2 "💾 Successfully downloaded Slack CLI v$LATEST_SLACK_CLI_VERSION to $(home_path "$slack_cli_install_dir/slack-cli.tar.gz")"
169+
delay 0.2 "💾 Successfully downloaded Slack CLI v$SLACK_CLI_DEV_VERSION to $(home_path "$slack_cli_install_dir/slack-cli.tar.gz")"
170170
fi
171171

172172
delay 0.3 "📦 Extracting the Slack CLI command binary to $(home_path "$slack_cli_bin_path")"

scripts/install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ install_slack_cli() {
165165
echo -e "\x1b[2m\n$slack_cli_url"
166166
curl -# -fLo "$slack_cli_install_dir/slack-cli.tar.gz" "$slack_cli_url"
167167
echo -e "\x1b[0m"
168-
delay 0.2 "💾 Successfully downloaded Slack CLI v$LATEST_SLACK_CLI_VERSION to $(home_path "$slack_cli_install_dir/slack-cli.tar.gz")"
168+
delay 0.2 "💾 Successfully downloaded Slack CLI v$SLACK_CLI_VERSION to $(home_path "$slack_cli_install_dir/slack-cli.tar.gz")"
169169

170170
delay 0.3 "📦 Extracting the Slack CLI command binary to $(home_path "$slack_cli_bin_path")"
171171
tar -xf "$slack_cli_install_dir/slack-cli.tar.gz" -C "$slack_cli_install_dir"

test/testutil/testutil.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,21 @@ package testutil
1717
import (
1818
"regexp"
1919

20-
"github.com/hashicorp/go-version"
2120
"github.com/slackapi/slack-cli/internal/iostreams"
2221
"github.com/spf13/cobra"
22+
"golang.org/x/mod/semver"
2323
)
2424

2525
// package + .test for root command
2626
var rootName string = "cmd.test"
2727

2828
// ContainsSemVer checks if a string contains valid semver
2929
func ContainsSemVer(s string) bool {
30-
matcher := regexp.MustCompile(version.SemverRegexpRaw)
31-
match := matcher.MatchString(s)
32-
return match
30+
if semver.IsValid("v"+s) || semver.IsValid(s) {
31+
return true
32+
}
33+
matcher := regexp.MustCompile(`[0-9]+\.[0-9]+\.[0-9]+`)
34+
return matcher.MatchString(s)
3335
}
3436

3537
// Set the command's IOStream to the mocked IOStream

0 commit comments

Comments
 (0)