Skip to content

Commit 2321d21

Browse files
committed
fix: update error formatting and test naming
This is for addressing the change in go1.24 golang/go#60529, which suppress the error on non-constant format and no args.
1 parent 1d759a2 commit 2321d21

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

Diff for: fieldpath/managers_test.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ limitations under the License.
1717
package fieldpath_test
1818

1919
import (
20-
"fmt"
2120
"reflect"
2221
"testing"
2322

@@ -155,7 +154,7 @@ func TestManagersEquals(t *testing.T) {
155154
}
156155

157156
for _, test := range tests {
158-
t.Run(fmt.Sprintf(test.name), func(t *testing.T) {
157+
t.Run(test.name, func(t *testing.T) {
159158
want := test.out
160159
got := test.lhs.Difference(test.rhs)
161160
if !reflect.DeepEqual(want, got) {
@@ -273,7 +272,7 @@ func TestManagersDifference(t *testing.T) {
273272
}
274273

275274
for _, test := range tests {
276-
t.Run(fmt.Sprintf(test.name), func(t *testing.T) {
275+
t.Run(test.name, func(t *testing.T) {
277276
equal := test.lhs.Equals(test.rhs)
278277
if test.equal && !equal {
279278
difference := test.lhs.Difference(test.rhs)

Diff for: internal/cli/operation.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ func (c compare) Execute(w io.Writer) error {
153153
// TODO: I think it'd be neat if we actually emitted a machine-readable
154154
// format.
155155

156-
_, err = fmt.Fprintf(w, got.String())
156+
_, err = fmt.Fprint(w, got.String())
157157

158158
return err
159159
}

Diff for: typed/validate.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ func (v *validatingObjectWalker) visitListItems(t *schema.List, list value.List)
157157
func (v *validatingObjectWalker) doList(t *schema.List) (errs ValidationErrors) {
158158
list, err := listValue(v.allocator, v.value)
159159
if err != nil {
160-
return errorf(err.Error())
160+
return errorf("%v", err)
161161
}
162162

163163
if list == nil {
@@ -193,7 +193,7 @@ func (v *validatingObjectWalker) visitMapItems(t *schema.Map, m value.Map) (errs
193193
func (v *validatingObjectWalker) doMap(t *schema.Map) (errs ValidationErrors) {
194194
m, err := mapValue(v.allocator, v.value)
195195
if err != nil {
196-
return errorf(err.Error())
196+
return errorf("%v", err)
197197
}
198198
if m == nil {
199199
return nil

0 commit comments

Comments
 (0)