Skip to content

Commit 7d41edf

Browse files
committed
Fix go 1.26 error strings
1 parent 43fb72c commit 7d41edf

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

pkg/schemaconv/openapi.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ func (c *convert) makeOpenAPIRef(specSchema *spec.Schema) schema.TypeRef {
140140
// to deduplicate)
141141
mapRelationship, err := getMapElementRelationship(specSchema.Extensions)
142142
if err != nil {
143-
c.reportError(err.Error())
143+
c.reportError("%s", err.Error())
144144
}
145145

146146
if len(mapRelationship) > 0 {
@@ -212,7 +212,7 @@ func (c *convert) parseObject(s *spec.Schema) *schema.Map {
212212

213213
relationship, err := getMapElementRelationship(s.Extensions)
214214
if err != nil {
215-
c.reportError(err.Error())
215+
c.reportError("%s", err.Error())
216216
}
217217

218218
return &schema.Map{
@@ -225,7 +225,7 @@ func (c *convert) parseObject(s *spec.Schema) *schema.Map {
225225
func (c *convert) parseList(s *spec.Schema) *schema.List {
226226
relationship, mapKeys, err := getListElementRelationship(s.Extensions)
227227
if err != nil {
228-
c.reportError(err.Error())
228+
c.reportError("%s", err.Error())
229229
}
230230
elementType := func() schema.TypeRef {
231231
if s.Items != nil {

pkg/schemaconv/proto_models.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ func (c *convert) VisitKind(k *proto.Kind) {
114114

115115
unions, err := makeUnions(k.GetExtensions())
116116
if err != nil {
117-
c.reportError(err.Error())
117+
c.reportError("%s", err.Error())
118118
return
119119
}
120120
// TODO: We should check that the fields and discriminator
@@ -129,14 +129,14 @@ func (c *convert) VisitKind(k *proto.Kind) {
129129

130130
a.Map.ElementRelationship, err = getMapElementRelationship(k.GetExtensions())
131131
if err != nil {
132-
c.reportError(err.Error())
132+
c.reportError("%s", err.Error())
133133
}
134134
}
135135

136136
func (c *convert) VisitArray(a *proto.Array) {
137137
relationship, mapKeys, err := getListElementRelationship(a.GetExtensions())
138138
if err != nil {
139-
c.reportError(err.Error())
139+
c.reportError("%s", err.Error())
140140
}
141141

142142
atom := c.top()
@@ -150,7 +150,7 @@ func (c *convert) VisitArray(a *proto.Array) {
150150
func (c *convert) VisitMap(m *proto.Map) {
151151
relationship, err := getMapElementRelationship(m.GetExtensions())
152152
if err != nil {
153-
c.reportError(err.Error())
153+
c.reportError("%s", err.Error())
154154
}
155155

156156
a := c.top()

pkg/validation/validate/result.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,13 +135,13 @@ func (r *Result) keepRelevantErrors() *Result {
135135
strippedErrors := []error{}
136136
for _, e := range r.Errors {
137137
if strings.HasPrefix(e.Error(), "IMPORTANT!") {
138-
strippedErrors = append(strippedErrors, fmt.Errorf(strings.TrimPrefix(e.Error(), "IMPORTANT!")))
138+
strippedErrors = append(strippedErrors, fmt.Errorf("%s", strings.TrimPrefix(e.Error(), "IMPORTANT!")))
139139
}
140140
}
141141
strippedWarnings := []error{}
142142
for _, e := range r.Warnings {
143143
if strings.HasPrefix(e.Error(), "IMPORTANT!") {
144-
strippedWarnings = append(strippedWarnings, fmt.Errorf(strings.TrimPrefix(e.Error(), "IMPORTANT!")))
144+
strippedWarnings = append(strippedWarnings, fmt.Errorf("%s", strings.TrimPrefix(e.Error(), "IMPORTANT!")))
145145
}
146146
}
147147
strippedResult := new(Result)

0 commit comments

Comments
 (0)