Skip to content

Commit 9a26d62

Browse files
chore(deps): update dependency golangci/golangci-lint to v2.11.2 (#41)
* chore(deps): update dependency golangci/golangci-lint to v2.11.2 * fix: Linting errors --------- Co-authored-by: netic-renovate[bot] <207156494+netic-renovate[bot]@users.noreply.github.com> Co-authored-by: Christian Bøgh Larsen [Netic] <cla@netic.dk>
1 parent b86069d commit 9a26d62

5 files changed

Lines changed: 14 additions & 14 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
- name: golangci-lint
3737
uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9
3838
with:
39-
version: v2.1
39+
version: v2.11.2
4040

4141
- name: Run tests
4242
run: go test -race -cover -v ./...

assert/assert.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -115,28 +115,28 @@ func (ae *AssertionError) Format(ctx *AssertionContext) string {
115115

116116
// Primary and comparison values
117117
if ae.PrimaryValue.Label != "" {
118-
sb.WriteString(fmt.Sprintf(" %s: %s\n", ae.PrimaryValue.Label, formatValue(ae.PrimaryValue.Value)))
118+
fmt.Fprintf(&sb, " %s: %s\n", ae.PrimaryValue.Label, formatValue(ae.PrimaryValue.Value))
119119
}
120120
if ae.ComparisonValue.Label != "" {
121-
sb.WriteString(fmt.Sprintf(" %s: %s\n", ae.ComparisonValue.Label, formatValue(ae.ComparisonValue.Value)))
121+
fmt.Fprintf(&sb, " %s: %s\n", ae.ComparisonValue.Label, formatValue(ae.ComparisonValue.Value))
122122
}
123123

124124
// Error if present
125125
if ae.Error != nil {
126-
sb.WriteString(fmt.Sprintf(" Error: %v\n", ae.Error))
126+
fmt.Fprintf(&sb, " Error: %v\n", ae.Error)
127127
}
128128

129129
// Extra key-value pairs
130130
for _, kv := range ae.ExtraValues {
131-
sb.WriteString(fmt.Sprintf(" %s: %s\n", kv.Label, formatValue(kv.Value)))
131+
fmt.Fprintf(&sb, " %s: %s\n", kv.Label, formatValue(kv.Value))
132132
}
133133

134134
// Diff if present
135135
if ae.Diff != "" {
136136
sb.WriteString(" Diff:\n")
137137
for line := range strings.SplitSeq(ae.Diff, "\n") {
138138
if line != "" {
139-
sb.WriteString(fmt.Sprintf(" %s\n", line))
139+
fmt.Fprintf(&sb, " %s\n", line)
140140
}
141141
}
142142
}
@@ -145,7 +145,7 @@ func (ae *AssertionError) Format(ctx *AssertionContext) string {
145145
if len(ae.Details) > 0 {
146146
sb.WriteString(" Details:\n")
147147
for _, detail := range ae.Details {
148-
sb.WriteString(fmt.Sprintf(" %s\n", detail))
148+
fmt.Fprintf(&sb, " %s\n", detail)
149149
}
150150
}
151151

@@ -155,7 +155,7 @@ func (ae *AssertionError) Format(ctx *AssertionContext) string {
155155
// Add indentation for the stack block
156156
for line := range strings.SplitSeq(ae.Stack, "\n") {
157157
if line != "" { // Avoid adding empty lines
158-
sb.WriteString(fmt.Sprintf(" %s\n", line))
158+
fmt.Fprintf(&sb, " %s\n", line)
159159
}
160160
}
161161
}

diff/format.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,23 +101,23 @@ func (c ContextFormatter) Format(edits []Line, options FormatOptions) string {
101101
switch edit.Kind {
102102
case Equal:
103103
if options.ShowLineNumbers {
104-
sb.WriteString(fmt.Sprintf("%4d %4d ", aLineNum, bLineNum))
104+
fmt.Fprintf(&sb, "%4d %4d ", aLineNum, bLineNum)
105105
} else {
106106
sb.WriteString(" ")
107107
}
108108
sb.WriteString(edit.Text)
109109
sb.WriteString("\n")
110110
case Delete:
111111
if options.ShowLineNumbers {
112-
sb.WriteString(fmt.Sprintf("%4d - ", aLineNum))
112+
fmt.Fprintf(&sb, "%4d - ", aLineNum)
113113
} else {
114114
sb.WriteString("- ")
115115
}
116116
sb.WriteString(edit.Text)
117117
sb.WriteString("\n")
118118
case Insert:
119119
if options.ShowLineNumbers {
120-
sb.WriteString(fmt.Sprintf(" %4d + ", bLineNum))
120+
fmt.Fprintf(&sb, " %4d + ", bLineNum)
121121
} else {
122122
sb.WriteString("+ ")
123123
}
@@ -163,7 +163,7 @@ func (u UnifiedFormatter) Format(edits []Line, options FormatOptions) string {
163163
hunkHeader := calculateHunkHeader(edits, r)
164164

165165
// Format the @@ hunk header
166-
sb.WriteString(fmt.Sprintf("@@ -%s +%s @@\n", hunkHeader.aRange, hunkHeader.bRange))
166+
fmt.Fprintf(&sb, "@@ -%s +%s @@\n", hunkHeader.aRange, hunkHeader.bRange)
167167

168168
// Write Hunk Body
169169
// Iterate through the chunk range to write the body

go.mod

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

3-
go 1.24.1
3+
go 1.26.1
44

55
require golang.org/x/sys v0.41.0
66

xstructs/map.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,8 @@ func (h *handler) handleMap(obj any) any {
213213
// handleSlice handles the conversion of a slice to a slice of any,
214214
// recursively converting nested maps, slices and structs.
215215
func (h *handler) handleSlice(obj any) any {
216-
s := []any{}
217216
val := reflect.ValueOf(obj)
217+
s := make([]any, 0, val.Len())
218218
for i := range val.Len() {
219219
s = append(s, h.handle(val.Index(i).Interface()))
220220
}

0 commit comments

Comments
 (0)