Skip to content

Commit 762d108

Browse files
authored
Merge pull request #530 from cbosdo/revive-fixes
Fix redefined built-in identifiers
2 parents 42248fb + 63929dd commit 762d108

File tree

6 files changed

+24
-24
lines changed

6 files changed

+24
-24
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
- name: Setup Go ${{ matrix.go-version }}
2828
uses: actions/setup-go@v5
2929
with:
30-
go-version: '1.21'
30+
go-version: '1.22'
3131

3232
- name: Install dependencies
3333
run: |

.github/workflows/golangci-lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- uses: actions/checkout@v4
2323
- uses: actions/setup-go@v5
2424
with:
25-
go-version: '1.21'
25+
go-version: '1.22'
2626
cache: false
2727
- name: golangci-lint
2828
uses: golangci/golangci-lint-action@v6

go.mod

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

3-
go 1.21
3+
go 1.22
44

55
require (
66
github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2

mgrpxy/cmd/cache/clear.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ func NewClearCmd(globalFlags *types.GlobalFlags) *cobra.Command {
2323
Long: L("Clear the cache"),
2424
RunE: func(cmd *cobra.Command, args []string) error {
2525
var flags cacheClearFlags
26-
return utils.CommandHelper(globalFlags, cmd, args, &flags, nil, clear)
26+
return utils.CommandHelper(globalFlags, cmd, args, &flags, nil, clearCmd)
2727
},
2828
}
2929

3030
return clearCmd
3131
}
3232

33-
func clear(globalFlags *types.GlobalFlags, flags *cacheClearFlags, cmd *cobra.Command, args []string) error {
33+
func clearCmd(globalFlags *types.GlobalFlags, flags *cacheClearFlags, cmd *cobra.Command, args []string) error {
3434
fn, err := shared.ChooseProxyPodmanOrKubernetes(cmd.Flags(), podmanCacheClear, kubernetesCacheClear)
3535
if err != nil {
3636
return err

shared/utils/utils.go

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -49,24 +49,24 @@ type InspectResult struct {
4949
Debug bool `mapstructure:"debug"`
5050
}
5151

52-
func checkValueSize(value string, min int, max int) bool {
53-
if min == 0 && max == 0 {
52+
func checkValueSize(value string, minValue int, maxValue int) bool {
53+
if minValue == 0 && maxValue == 0 {
5454
return true
5555
}
5656

57-
if len(value) < min {
58-
fmt.Printf(NL("Has to be more than %d character long", "Has to be more than %d characters long", min), min)
57+
if len(value) < minValue {
58+
fmt.Printf(NL("Has to be more than %d character long", "Has to be more than %d characters long", minValue), minValue)
5959
return false
6060
}
61-
if len(value) > max {
62-
fmt.Printf(NL("Has to be less than %d character long", "Has to be less than %d characters long", max), max)
61+
if len(value) > maxValue {
62+
fmt.Printf(NL("Has to be less than %d character long", "Has to be less than %d characters long", maxValue), maxValue)
6363
return false
6464
}
6565
return true
6666
}
6767

6868
// CheckValidPassword performs check to a given password.
69-
func CheckValidPassword(value *string, prompt string, min int, max int) string {
69+
func CheckValidPassword(value *string, prompt string, minValue int, maxValue int) string {
7070
fmt.Print(prompt + promptEnd)
7171
bytePassword, err := term.ReadPassword(int(syscall.Stdin))
7272
if err != nil {
@@ -88,7 +88,7 @@ func CheckValidPassword(value *string, prompt string, min int, max int) string {
8888
return ""
8989
}
9090

91-
if !checkValueSize(tmpValue, min, max) {
91+
if !checkValueSize(tmpValue, minValue, maxValue) {
9292
fmt.Println()
9393
return ""
9494
}
@@ -99,18 +99,18 @@ func CheckValidPassword(value *string, prompt string, min int, max int) string {
9999

100100
// AskPasswordIfMissing asks for password if missing.
101101
// Don't perform any check if min and max are set to 0.
102-
func AskPasswordIfMissing(value *string, prompt string, min int, max int) {
102+
func AskPasswordIfMissing(value *string, prompt string, minValue int, maxValue int) {
103103
if *value == "" && !term.IsTerminal(int(os.Stdin.Fd())) {
104104
log.Warn().Msgf(L("not an interactive device, not asking for missing value"))
105105
return
106106
}
107107

108108
for *value == "" {
109-
firstRound := CheckValidPassword(value, prompt, min, max)
109+
firstRound := CheckValidPassword(value, prompt, minValue, maxValue)
110110
if firstRound == "" {
111111
continue
112112
}
113-
secondRound := CheckValidPassword(value, L("Confirm the password"), min, max)
113+
secondRound := CheckValidPassword(value, L("Confirm the password"), minValue, maxValue)
114114
if secondRound != firstRound {
115115
fmt.Println(L("Two different passwords have been provided"))
116116
*value = ""
@@ -122,20 +122,20 @@ func AskPasswordIfMissing(value *string, prompt string, min int, max int) {
122122

123123
// AskPasswordIfMissingOnce asks for password if missing only once
124124
// Don't perform any check if min and max are set to 0.
125-
func AskPasswordIfMissingOnce(value *string, prompt string, min int, max int) {
125+
func AskPasswordIfMissingOnce(value *string, prompt string, minValue int, maxValue int) {
126126
if *value == "" && !term.IsTerminal(int(os.Stdin.Fd())) {
127127
log.Warn().Msgf(L("not an interactive device, not asking for missing value"))
128128
return
129129
}
130130

131131
for *value == "" {
132-
*value = CheckValidPassword(value, prompt, min, max)
132+
*value = CheckValidPassword(value, prompt, minValue, maxValue)
133133
}
134134
}
135135

136136
// AskIfMissing asks for a value if missing.
137-
// Don't perform any check if min and max are set to 0.
138-
func AskIfMissing(value *string, prompt string, min int, max int, checker func(string) bool) {
137+
// Don't perform any check if minValue and maxValue are set to 0.
138+
func AskIfMissing(value *string, prompt string, minValue int, maxValue int, checker func(string) bool) {
139139
if *value == "" && !term.IsTerminal(int(os.Stdin.Fd())) {
140140
log.Warn().Msgf(L("not an interactive device, not asking for missing value"))
141141
return
@@ -149,7 +149,7 @@ func AskIfMissing(value *string, prompt string, min int, max int, checker func(s
149149
log.Fatal().Err(err).Msg(L("failed to read input"))
150150
}
151151
tmpValue := strings.TrimSpace(newValue)
152-
if checkValueSize(tmpValue, min, max) && (checker == nil || checker(tmpValue)) {
152+
if checkValueSize(tmpValue, minValue, maxValue) && (checker == nil || checker(tmpValue)) {
153153
*value = tmpValue
154154
}
155155
fmt.Println()

uyuni-tools.spec

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,12 @@ BuildRequires: fish
8080
BuildRequires: zsh
8181
# Get the proper Go version on different distros
8282
%if 0%{?suse_version}
83-
BuildRequires: golang(API) >= 1.21
83+
BuildRequires: golang(API) >= 1.22
8484
%endif
8585
# 0%{?suse_version}
8686

8787
%if 0%{?ubuntu}
88-
%define go_version 1.21
88+
%define go_version 1.22
8989
BuildRequires: golang-%{go_version}
9090
%endif
9191
# 0%{?ubuntu}
@@ -96,7 +96,7 @@ BuildRequires: golang >= 1.19
9696
# 0%{?debian}
9797

9898
%if 0%{?fedora} || 0%{?rhel}
99-
BuildRequires: golang >= 1.21
99+
BuildRequires: golang >= 1.22
100100
%endif
101101
# 0%{?fedora} || 0%{?rhel}
102102

0 commit comments

Comments
 (0)