Skip to content

Commit

Permalink
Merge pull request #3852 from saschagrunert/lint
Browse files Browse the repository at this point in the history
Update golangci-lint to v1.62
  • Loading branch information
k8s-ci-robot authored Dec 10, 2024
2 parents 81d94f3 + 5f7f4b3 commit 2265436
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8 # v6.1.1
with:
version: v1.61
version: v1.62
2 changes: 2 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ linters:
- gosmopolitan
- govet
- grouper
- iface
- importas
- ineffassign
- intrange
Expand All @@ -72,6 +73,7 @@ linters:
- promlinter
- protogetter
- reassign
- recvcheck
- revive
- rowserrcheck
- sloglint
Expand Down
22 changes: 15 additions & 7 deletions cmd/krel/cmd/release_notes.go
Original file line number Diff line number Diff line change
Expand Up @@ -1184,7 +1184,8 @@ func fixReleaseNotes(workDir string, releaseNotes *notes.ReleaseNotes) error {
_, choice, err := util.Ask(fmt.Sprintf("\n- Fix note for PR #%d? (y/N)", note.PrNumber), "y:Y:yes|n:N:no|n", 10)
if err != nil {
// If the user cancelled with ctr+c exit and continue the PR flow
if err.(util.UserInputError).IsCtrlC() {
var userInputErr util.UserInputError
if errors.As(err, &userInputErr) && userInputErr.IsCtrlC() {
logrus.Info("Input cancelled, exiting edit flow")
return nil
}
Expand Down Expand Up @@ -1240,8 +1241,10 @@ func fixReleaseNotes(workDir string, releaseNotes *notes.ReleaseNotes) error {
func pointIfChanged(label string, var1, var2 interface{}) string {
changed := false
// Check if alues are string
if _, ok := var1.(string); ok {
if var1.(string) != var2.(string) {
var1String, ok1 := var1.(string)
var2String, ok2 := var2.(string)
if ok1 && ok2 {
if var1String != var2String {
changed = true
}
}
Expand All @@ -1253,9 +1256,11 @@ func pointIfChanged(label string, var1, var2 interface{}) string {
}
}

// Check if string slices
if _, ok := var1.(bool); ok {
if var1.(bool) != var2.(bool) {
// Check if bools
var1Bool, ok1 := var1.(bool)
var2Bool, ok2 := var2.(bool)
if ok1 && ok2 {
if var1Bool != var2Bool {
changed = true
}
}
Expand Down Expand Up @@ -1458,9 +1463,12 @@ func confirmWithUser(opts *releaseNotesOptions, question string) bool {
_, success, err := util.Ask(question+" (Y/n)", "y:Y:yes|n:N:no|y", 10)
if err != nil {
logrus.Error(err)
if err.(util.UserInputError).IsCtrlC() {

var userInputErr util.UserInputError
if errors.As(err, &userInputErr) && userInputErr.IsCtrlC() {
os.Exit(1)
}

return false
}
if success {
Expand Down
2 changes: 1 addition & 1 deletion dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ dependencies:

# golangci-lint-version
- name: "golangci-lint"
version: v1.61
version: v1.62
refPaths:
- path: .github/workflows/lint.yml
match: "version: v\\d+.\\d+?\\.?(\\d+)?"
Expand Down
4 changes: 3 additions & 1 deletion pkg/cve/cve.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ func (cve *CVE) ReadRawInterface(cvedata interface{}) error {
if val, ok := cvedata.(map[interface{}]interface{})["linkedPRs"].([]interface{}); ok {
cve.LinkedPRs = []int{}
for _, prid := range val {
cve.LinkedPRs = append(cve.LinkedPRs, prid.(int))
if prid, ok := prid.(int); ok {
cve.LinkedPRs = append(cve.LinkedPRs, prid)
}
}
}

Expand Down

0 comments on commit 2265436

Please sign in to comment.