Skip to content

Commit

Permalink
feat(ci): update helm and go version in ci workflow (#675)
Browse files Browse the repository at this point in the history
* feat(ci): update helm and go version in ci workflow

Signed-off-by: yxxhero <[email protected]>

* refactor: use _ to discard fmt.Fprintf return value

Signed-off-by: yxxhero <[email protected]>

* fix more lint issue

Signed-off-by: yxxhero <[email protected]>

* fix more lint issue

Signed-off-by: yxxhero <[email protected]>

---------

Signed-off-by: yxxhero <[email protected]>
  • Loading branch information
yxxhero authored Oct 18, 2024
1 parent fe9c4da commit 8294164
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 28 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
os: [ubuntu-latest, macos-latest, windows-latest]
shell: [ default ]
experimental: [ false ]
helm-version: [ v3.15.4, v3.16.1 ]
helm-version: [ v3.15.4, v3.16.2 ]
include:
- os: windows-latest
shell: wsl
Expand All @@ -61,16 +61,16 @@ jobs:
- os: windows-latest
shell: wsl
experimental: false
helm-version: v3.16.1
helm-version: v3.16.2
- os: windows-latest
shell: cygwin
experimental: false
helm-version: v3.16.1
helm-version: v3.16.2
- os: ubuntu-latest
container: alpine
shell: sh
experimental: false
helm-version: v3.16.1
helm-version: v3.16.2

steps:
- name: Disable autocrlf
Expand Down Expand Up @@ -111,7 +111,7 @@ jobs:
# That's why we cover only 2 Helm minor versions in this matrix.
# See https://github.com/helmfile/helmfile/pull/286#issuecomment-1250161182 for more context.
- helm-version: v3.15.4
- helm-version: v3.16.1
- helm-version: v3.16.2
steps:
- uses: engineerd/[email protected]
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ jobs:
go-version-file: 'go.mod'
- uses: golangci/golangci-lint-action@v6
with:
version: v1.56.0
version: v1.61.0
5 changes: 3 additions & 2 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ run:

# output configuration options
output:
formats:
# colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number"
format: line-number
- format: line-number

# print lines of code with issue, default is true
print-issued-lines: true
Expand Down Expand Up @@ -290,7 +291,7 @@ linters:
- depguard
- errcheck
- errorlint
- exportloopref
- copyloopvar
- funlen
- gci
- gocognit
Expand Down
12 changes: 6 additions & 6 deletions diff/diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ func printDiffRecords(suppressedKinds []string, kind string, context int, diffs
for _, ckind := range suppressedKinds {
if ckind == kind {
str := fmt.Sprintf("+ Changes suppressed on sensitive content of type %s\n", kind)
fmt.Fprint(to, ansi.Color(str, "yellow"))
_, _ = fmt.Fprint(to, ansi.Color(str, "yellow"))
return
}
}
Expand All @@ -343,7 +343,7 @@ func printDiffRecords(suppressedKinds []string, kind string, context int, diffs
for i, diff := range diffs {
if distances[i] > context {
if !omitting {
fmt.Fprintln(to, "...")
_, _ = fmt.Fprintln(to, "...")
omitting = true
}
} else {
Expand All @@ -363,14 +363,14 @@ func printDiffRecord(diff difflib.DiffRecord, to io.Writer) {

switch diff.Delta {
case difflib.RightOnly:
fmt.Fprintf(to, "%s\n", ansi.Color("+ "+text, "green"))
_, _ = fmt.Fprintf(to, "%s\n", ansi.Color("+ "+text, "green"))
case difflib.LeftOnly:
fmt.Fprintf(to, "%s\n", ansi.Color("- "+text, "red"))
_, _ = fmt.Fprintf(to, "%s\n", ansi.Color("- "+text, "red"))
case difflib.Common:
if text == "" {
fmt.Fprintln(to)
_, _ = fmt.Fprintln(to)
} else {
fmt.Fprintf(to, "%s\n", " "+text)
_, _ = fmt.Fprintf(to, "%s\n", " "+text)
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions diff/report.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ func setupDiffReport(r *Report) {
// print report for default output: diff
func printDiffReport(r *Report, to io.Writer) {
for _, entry := range r.entries {
fmt.Fprintf(to, ansi.Color("%s %s", "yellow")+"\n", entry.key, r.format.changestyles[entry.changeType].message)
_, _ = fmt.Fprintf(to, ansi.Color("%s %s", "yellow")+"\n", entry.key, r.format.changestyles[entry.changeType].message)
printDiffRecords(entry.suppressedKinds, entry.kind, entry.context, entry.diffs, to)
}
}
Expand All @@ -170,13 +170,13 @@ func printSimpleReport(r *Report, to io.Writer) {
"MODIFY": 0,
}
for _, entry := range r.entries {
fmt.Fprintf(to, ansi.Color("%s %s", r.format.changestyles[entry.changeType].color)+"\n",
_, _ = fmt.Fprintf(to, ansi.Color("%s %s", r.format.changestyles[entry.changeType].color)+"\n",
entry.key,
r.format.changestyles[entry.changeType].message,
)
summary[entry.changeType]++
}
fmt.Fprintf(to, "Plan: %d to add, %d to change, %d to destroy.\n", summary["ADD"], summary["MODIFY"], summary["REMOVE"])
_, _ = fmt.Fprintf(to, "Plan: %d to add, %d to change, %d to destroy.\n", summary["ADD"], summary["MODIFY"], summary["REMOVE"])
}

func newTemplate(name string) *template.Template {
Expand Down
4 changes: 1 addition & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
module github.com/databus23/helm-diff/v3

go 1.22.0

toolchain go1.22.4
go 1.23.2

require (
github.com/Masterminds/semver/v3 v3.3.0
Expand Down
16 changes: 8 additions & 8 deletions main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func runFakeHelm() int {
var stub *fakeHelmSubcmd

if len(os.Args) < 2 {
fmt.Fprintln(os.Stderr, "fake helm does not support invocations without subcommands")
_, _ = fmt.Fprintln(os.Stderr, "fake helm does not support invocations without subcommands")
return 1
}

Expand All @@ -90,7 +90,7 @@ func runFakeHelm() int {
}

if stub == nil {
fmt.Fprintf(os.Stderr, "no stub for %s\n", cmdAndArgs)
_, _ = fmt.Fprintf(os.Stderr, "no stub for %s\n", cmdAndArgs)
return 1
}

Expand All @@ -100,13 +100,13 @@ func runFakeHelm() int {
}
got := cmdAndArgs[len(stub.cmd):]
if !reflect.DeepEqual(want, got) {
fmt.Fprintf(os.Stderr, "want: %v\n", want)
fmt.Fprintf(os.Stderr, "got : %v\n", got)
fmt.Fprintf(os.Stderr, "args : %v\n", os.Args)
fmt.Fprintf(os.Stderr, "env : %v\n", os.Environ())
_, _ = fmt.Fprintf(os.Stderr, "want: %v\n", want)
_, _ = fmt.Fprintf(os.Stderr, "got : %v\n", got)
_, _ = fmt.Fprintf(os.Stderr, "args : %v\n", os.Args)
_, _ = fmt.Fprintf(os.Stderr, "env : %v\n", os.Environ())
return 1
}
fmt.Fprintf(os.Stdout, "%s", stub.stdout)
fmt.Fprintf(os.Stderr, "%s", stub.stderr)
_, _ = fmt.Fprintf(os.Stdout, "%s", stub.stdout)
_, _ = fmt.Fprintf(os.Stderr, "%s", stub.stderr)
return stub.exitCode
}

0 comments on commit 8294164

Please sign in to comment.