Skip to content

Commit 943f2f3

Browse files
authored
remove dependency for slices package (#85)
* remove dependency for slices package * update golang build env version
1 parent 0ec2152 commit 943f2f3

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- name: Set up go
1717
uses: actions/setup-go@v3
1818
with:
19-
go-version: 1.20.14
19+
go-version: 1.19.2
2020

2121
- name: Build
2222
run: bash hack/github-release.sh

cmd/api.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"fmt"
77
"io"
88
"io/ioutil"
9-
"slices"
109
"strconv"
1110
"strings"
1211
"sync"
@@ -50,7 +49,7 @@ func NewCmdAPI(out io.Writer) *cobra.Command {
5049
Short: "Call API",
5150
Long: "Call API",
5251
Run: func(c *cobra.Command, args []string) {
53-
if slices.Contains(args, "--help") {
52+
if containHelp(args) {
5453
fmt.Fprintln(out, HelpInfo)
5554
return
5655
}
@@ -251,3 +250,12 @@ func genericInvokeRepeatWrapper(repeatsConfig *RepeatsConfig, params map[string]
251250
refresh.Do(fmt.Sprintf("finally, total:%d, success:%d, fail:%d", repeats, success.Load(), repeats-int(success.Load())))
252251
return nil
253252
}
253+
254+
func containHelp(args []string) bool {
255+
for _, arg := range args {
256+
if arg == "--help" {
257+
return true
258+
}
259+
}
260+
return false
261+
}

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/ucloud/ucloud-cli
22

3-
go 1.20
3+
go 1.19
44

55
require (
66
github.com/fatih/color v1.13.0

0 commit comments

Comments
 (0)