Skip to content

Commit

Permalink
remove dependency for slices package (#85)
Browse files Browse the repository at this point in the history
* remove dependency for slices package

* update golang build env version
  • Loading branch information
wangrzneu authored May 8, 2024
1 parent 0ec2152 commit 943f2f3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Set up go
uses: actions/setup-go@v3
with:
go-version: 1.20.14
go-version: 1.19.2

- name: Build
run: bash hack/github-release.sh
Expand Down
12 changes: 10 additions & 2 deletions cmd/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"fmt"
"io"
"io/ioutil"
"slices"
"strconv"
"strings"
"sync"
Expand Down Expand Up @@ -50,7 +49,7 @@ func NewCmdAPI(out io.Writer) *cobra.Command {
Short: "Call API",
Long: "Call API",
Run: func(c *cobra.Command, args []string) {
if slices.Contains(args, "--help") {
if containHelp(args) {
fmt.Fprintln(out, HelpInfo)
return
}
Expand Down Expand Up @@ -251,3 +250,12 @@ func genericInvokeRepeatWrapper(repeatsConfig *RepeatsConfig, params map[string]
refresh.Do(fmt.Sprintf("finally, total:%d, success:%d, fail:%d", repeats, success.Load(), repeats-int(success.Load())))
return nil
}

func containHelp(args []string) bool {
for _, arg := range args {
if arg == "--help" {
return true
}
}
return false
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/ucloud/ucloud-cli

go 1.20
go 1.19

require (
github.com/fatih/color v1.13.0
Expand Down

0 comments on commit 943f2f3

Please sign in to comment.