Skip to content

Commit dbf94e3

Browse files
Fix non-constant format string errors
go 1.26.1 no like
1 parent f0fcc33 commit dbf94e3

4 files changed

Lines changed: 17 additions & 17 deletions

File tree

chunker/rdf_state.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ func lexText(l *lex.Lexer) lex.StateFn {
147147
// Assumes that caller has consumed initial '<'
148148
func lexIRIRef(l *lex.Lexer, styp lex.ItemType, sfn lex.StateFn) lex.StateFn {
149149
if err := lex.IRIRef(l, styp); err != nil {
150-
return l.Errorf(err.Error())
150+
return l.Errorf("%s", err.Error())
151151
}
152152
return sfn
153153
}
@@ -384,7 +384,7 @@ forLoop:
384384
return nil
385385
case r == quote:
386386
if err := l.LexQuotedString(); err != nil {
387-
return l.Errorf(err.Error())
387+
return l.Errorf("%s", err.Error())
388388
}
389389
l.Emit(itemText)
390390
default:

dql/state.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ func lexContent(l *lex.Lexer, leftRune, rightRune rune, returnTo lex.StateFn) le
131131
return l.Errorf("Matching brackets not found")
132132
case quote:
133133
if err := l.LexQuotedString(); err != nil {
134-
return l.Errorf(err.Error())
134+
return l.Errorf("%s", err.Error())
135135
}
136136
case leftRune:
137137
depth++
@@ -291,7 +291,7 @@ func lexFuncOrArg(l *lex.Lexer) lex.StateFn {
291291
{
292292
empty = false
293293
if err := l.LexQuotedString(); err != nil {
294-
return l.Errorf(err.Error())
294+
return l.Errorf("%s", err.Error())
295295
}
296296
l.Emit(itemName)
297297
}
@@ -449,7 +449,7 @@ func lexQuery(l *lex.Lexer) lex.StateFn {
449449

450450
func lexIRIRef(l *lex.Lexer) lex.StateFn {
451451
if err := lex.IRIRef(l, itemName); err != nil {
452-
return l.Errorf(err.Error())
452+
return l.Errorf("%s", err.Error())
453453
}
454454
return l.Mode
455455
}

graphql/e2e/common/common.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,14 @@ var (
5555
retryableCreateNamespaceErrors = append(retryableUpdateGQLSchemaErrors,
5656
"is not indexed",
5757
)
58-
59-
safelyUpdateGQLSchemaErr = "New Counter: %v, Old Counter: %v.\n" +
60-
"Schema update counter didn't increment, " +
61-
"indicating that the GraphQL layer didn't get the updated schema even after 10" +
62-
" retries. The most probable cause is the new GraphQL schema is same as the old" +
63-
" GraphQL schema."
6458
)
6559

60+
const safelyUpdateGQLSchemaErr = "New Counter: %v, Old Counter: %v.\n" +
61+
"Schema update counter didn't increment, " +
62+
"indicating that the GraphQL layer didn't get the updated schema even after 10" +
63+
" retries. The most probable cause is the new GraphQL schema is same as the old" +
64+
" GraphQL schema."
65+
6666
// GraphQLParams is parameters for constructing a GraphQL query - that's
6767
// http POST with this body, or http GET with this in the query string.
6868
//

query/outputnode_graphql.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ func (genc *graphQLEncoder) encode(encInp encodeInput) bool {
8484
val, err := genc.getScalarVal(encInp.fj)
8585
if err != nil {
8686
genc.errs = append(genc.errs, encInp.parentField.GqlErrorf(encInp.parentPath,
87-
err.Error()))
87+
"%s", err.Error()))
8888
// return false so that the caller can appropriately handle null writing.
8989
return false
9090
}
@@ -592,7 +592,7 @@ func (genc *graphQLEncoder) writeCustomField(curSelection gqlSchema.Field,
592592

593593
// if there was an error getting the value, append the error
594594
genc.errs = append(genc.errs, curSelection.GqlErrorf(append(parentPath,
595-
curSelection.ResponseName()), err.Error()))
595+
curSelection.ResponseName()), "%s", err.Error()))
596596
}
597597

598598
// if no custom fastJson node was found or there was error getting the value, return false
@@ -652,7 +652,7 @@ func (genc *graphQLEncoder) processCustomFields(field gqlSchema.Field, n fastJso
652652
for _, parent := range res.parents {
653653
childNode, err := genc.makeCustomNode(childAttr, res.childVal)
654654
if err != nil {
655-
genc.errCh <- x.GqlErrorList{res.childField.GqlErrorf(nil, err.Error())}
655+
genc.errCh <- x.GqlErrorList{res.childField.GqlErrorf(nil, "%s", err.Error())}
656656
continue
657657
}
658658
childNode.next = parent.child
@@ -740,7 +740,7 @@ func (genc *graphQLEncoder) resolveCustomField(childField gqlSchema.Field,
740740

741741
fconf, err := childField.CustomHTTPConfig()
742742
if err != nil {
743-
genc.errCh <- x.GqlErrorList{childField.GqlErrorf(nil, err.Error())}
743+
genc.errCh <- x.GqlErrorList{childField.GqlErrorf(nil, "%s", err.Error())}
744744
return
745745
}
746746
// for resolving a custom field, we need to carry out following steps:
@@ -1116,7 +1116,7 @@ func (genc *graphQLEncoder) completeRootAggregateQuery(fj fastJsonNode, query gq
11161116
val, err = genc.getScalarVal(genc.children(fj))
11171117
if err != nil {
11181118
genc.errs = append(genc.errs, f.GqlErrorf(append(qryPath,
1119-
f.ResponseName()), err.Error()))
1119+
f.ResponseName()), "%s", err.Error()))
11201120
// all aggregate properties are nullable, so no special checks are required
11211121
val = gqlSchema.JsonNull
11221122
}
@@ -1191,7 +1191,7 @@ func (genc *graphQLEncoder) completeAggregateChildren(fj fastJsonNode,
11911191
val, err = genc.getScalarVal(fj)
11921192
if err != nil {
11931193
genc.errs = append(genc.errs, f.GqlErrorf(append(fieldPath,
1194-
f.ResponseName()), err.Error()))
1194+
f.ResponseName()), "%s", err.Error()))
11951195
// all aggregate properties are nullable, so no special checks are required
11961196
val = gqlSchema.JsonNull
11971197
}

0 commit comments

Comments
 (0)