Skip to content

Commit

Permalink
fix: golangci-lint issue
Browse files Browse the repository at this point in the history
  • Loading branch information
reki9185 committed Jan 22, 2025
1 parent 412a5b9 commit 28c8637
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
25 changes: 25 additions & 0 deletions 0001-fix-out-of-range-error-in-suci-to-supi.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
From c2de80957d82b491962d668414a684350585d6f1 Mon Sep 17 00:00:00 2001
From: reki9185 <[email protected]>
Date: Tue, 21 Jan 2025 13:30:12 +0800
Subject: [PATCH] fix: out of range error in suci to supi

---
pkg/suci/suci.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pkg/suci/suci.go b/pkg/suci/suci.go
index 8c22f37..506f2c0 100644
--- a/pkg/suci/suci.go
+++ b/pkg/suci/suci.go
@@ -382,7 +382,7 @@ func ToSupi(suci string, suciProfiles []SuciProfile) (string, error) {
if err != nil {
return "", fmt.Errorf("Parse HNPublicKeyID error: %+v", err)
}
- if keyIndex > len(suciProfiles) {
+ if keyIndex < 1 || keyIndex > len(suciProfiles) {
return "", fmt.Errorf("keyIndex(%d) out of range(%d)", keyIndex, len(suciProfiles))
}

--
2.34.1

2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
github.com/h2non/gock v1.2.0
github.com/pkg/errors v0.9.1
github.com/sirupsen/logrus v1.9.3
github.com/stretchr/testify v1.9.0
github.com/stretchr/testify v1.10.0
github.com/urfave/cli v1.22.5
go.uber.org/mock v0.4.0
golang.org/x/crypto v0.31.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXl
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/tim-ywliu/nested-logrus-formatter v1.3.2 h1:jugNJ2/CNCI79SxOJCOhwUHeN3O7/7/bj+ZRGOFlCSw=
github.com/tim-ywliu/nested-logrus-formatter v1.3.2/go.mod h1:oGPmcxZB65j9Wo7mCnQKSrKEJtVDqyjD666SGmyStXI=
github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI=
Expand Down

0 comments on commit 28c8637

Please sign in to comment.