Skip to content

Commit 4061a55

Browse files
committed
Fix vet errors
1 parent 1df14af commit 4061a55

File tree

8 files changed

+239
-239
lines changed

8 files changed

+239
-239
lines changed

gir/girgen/generators/callable/callable.go

Lines changed: 209 additions & 207 deletions
Large diffs are not rendered by default.

gir/girgen/generators/record.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -411,8 +411,8 @@ func (rg *RecordGenerator) getters() {
411411

412412
switch converted.Direction {
413413
case typeconv.ConvertCToGo: // getter
414-
b.Linef(converted.Out.Declare)
415-
b.Linef(converted.Conversion)
414+
b.Linef("%s", converted.Out.Declare)
415+
b.Linef("%s", converted.Conversion)
416416
b.Linef("return _v")
417417

418418
rg.Getters = append(rg.Getters, recordGetter{
@@ -422,7 +422,7 @@ func (rg *RecordGenerator) getters() {
422422
InfoElements: info,
423423
})
424424
case typeconv.ConvertGoToC: // setter
425-
b.Linef(converted.Conversion)
425+
b.Line(converted.Conversion)
426426

427427
rg.Setters = append(rg.Setters, recordSetter{
428428
Name: strcases.SnakeToGo(true, converted.Name),

gir/girgen/generators/union.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,8 @@ func (ug *UnionGenerator) Use(union *gir.Union) bool {
190190
p.Linef("runtime.SetFinalizer(")
191191
p.Linef(" gextras.StructIntern(unsafe.Pointer(dst)),")
192192
p.Linef(" func(intern *struct{ C unsafe.Pointer }) {")
193-
p.Linef(types.RecordPrintFree(ug.gen, &typRecord, "intern.C"))
194-
p.Linef("},")
193+
p.Linef(" %s", types.RecordPrintFree(ug.gen, &typRecord, "intern.C"))
194+
p.Linef(" },")
195195
p.Linef(")")
196196
p.Linef("return dst")
197197

@@ -256,7 +256,7 @@ func (ug *UnionGenerator) Use(union *gir.Union) bool {
256256
}
257257

258258
p.Linef("var dst %s", srcRes.Out.Type)
259-
p.Linef(srcRes.Conversion)
259+
p.Linef("%s", srcRes.Conversion)
260260

261261
// We should free the copy when we're done if this is a record, since we
262262
// copied it earlier.
@@ -268,8 +268,8 @@ func (ug *UnionGenerator) Use(union *gir.Union) bool {
268268
// dst is ASSUMED TO BE A POINTER.
269269
p.Linef(" gextras.StructIntern(unsafe.Pointer(dst)),")
270270
p.Linef(" func(intern *struct{ C unsafe.Pointer }) {")
271-
p.Linef(types.RecordPrintFree(ug.gen, &typRecord, "intern.C"))
272-
p.Linef("},")
271+
p.Linef(" %s", types.RecordPrintFree(ug.gen, &typRecord, "intern.C"))
272+
p.Linef(" },")
273273
p.Linef(")")
274274
}
275275

gir/girgen/logger/logger.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ func Stdlog(logger *log.Logger, minlevel, level Level, v ...interface{}) {
9494

9595
prefix := level.prefix()
9696
if prefix != "" {
97-
prefix = level.colorf(prefix)
97+
prefix = level.colorf("%s", prefix)
9898
v = Prefix(v, prefix)
9999
}
100100

gir/girgen/pen/pen.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ func (p *Pen) Lines(lines []string) {
7373
}
7474

7575
// Line writes a single line.
76-
func (p *Pen) Line(line string) { p.Linef(line) }
76+
func (p *Pen) Line(line string) { p.Linef("%s", line) }
7777

7878
// Linef writes a Sprintf-formatted line.
7979
func (p *Pen) Linef(f string, v ...interface{}) {

gir/girgen/pen/section.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ func (sects *BlockSections) Linef(sect int, f string, v ...interface{}) {
6363
}
6464

6565
// Line writes a single line into the given section.
66-
func (sects *BlockSections) Line(sect int, line string) { sects.Linef(sect, line) }
66+
func (sects *BlockSections) Line(sect int, line string) { sects.Linef(sect, "%s", line) }
6767

6868
// EmptyLine writes an empty line into the given section.
6969
func (sects *BlockSections) EmptyLine(sect int) {

gir/girgen/types/typeconv/c-go.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ func (conv *Converter) cgoArrayConverter(value *ValueConverted) bool {
190190
value.p.Linef("src := unsafe.Slice((*%s)(%s), %s)", inner.In.Type, value.In.Name, length.In.Name)
191191
value.p.Linef("%s = make(%s, %s)", value.Out.Set, value.Out.Type, length.In.Name)
192192
value.p.Linef("for i := 0; i < int(%s); i++ {", length.In.Name)
193-
value.p.Linef(inner.Conversion)
193+
value.p.Linef(" %s", inner.Conversion)
194194
value.p.Linef("}")
195195
value.p.Ascend()
196196
return true
@@ -206,7 +206,7 @@ func (conv *Converter) cgoArrayConverter(value *ValueConverted) bool {
206206
value.p.Linef("src := unsafe.Slice((*%s)(p), len)", inner.In.Type)
207207
value.p.Linef("%s = make(%s, len)", value.Out.Set, value.Out.Type)
208208
value.p.Linef("for i := 0; i < len; i++ {")
209-
value.p.Linef(inner.Conversion)
209+
value.p.Linef(" %s", inner.Conversion)
210210
value.p.Linef("}")
211211

212212
value.p.Ascend()
@@ -261,7 +261,7 @@ func (conv *Converter) cgoArrayConverter(value *ValueConverted) bool {
261261
value.p.Linef("src := unsafe.Slice(%s, i)", value.In.Name)
262262
value.p.Linef("%s = make(%s, i)", value.Out.Set, value.Out.Type)
263263
value.p.Linef("for i := range src {")
264-
value.p.Linef(inner.Conversion)
264+
value.p.Linef(" %s", inner.Conversion)
265265
value.p.Linef("}")
266266

267267
value.p.Ascend()
@@ -345,10 +345,10 @@ func (conv *Converter) cgoConvertNested(value *ValueConverted) bool {
345345
value.InNamePtr(1), value.ShouldFree())
346346
value.p.Linef("ksrc := *(*%s)(k)", kt.In.Type)
347347
value.p.Linef("vsrc := *(*%s)(v)", vt.In.Type)
348-
value.p.Linef(kt.Out.Declare)
349-
value.p.Linef(vt.Out.Declare)
350-
value.p.Linef(kt.Conversion)
351-
value.p.Linef(vt.Conversion)
348+
value.p.Linef("%s", kt.Out.Declare)
349+
value.p.Linef("%s", vt.Out.Declare)
350+
value.p.Linef("%s", kt.Conversion)
351+
value.p.Linef("%s", vt.Conversion)
352352
value.p.Linef("%s[kdst] = vdst", value.Out.Set)
353353
value.p.Linef("})")
354354

@@ -651,8 +651,8 @@ func (conv *Converter) cgoConverter(value *ValueConverted) bool {
651651
value.Logln(logger.Debug, "SetFinalizer set fail")
652652
}
653653

654-
value.p.Linef(types.RecordPrintFree(value.conv.fgen, value.Resolved.Extern, "intern.C"))
655-
value.p.Linef("},")
654+
value.p.Linef(" %s", types.RecordPrintFree(value.conv.fgen, value.Resolved.Extern, "intern.C"))
655+
value.p.Linef(" },")
656656
value.p.Linef(")")
657657
}
658658

gir/girgen/types/typeconv/go-c.go

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ func (conv *Converter) gocArrayConverter(value *ValueConverted) bool {
190190
}
191191

192192
value.p.Linef("for i := 0; i < %d; i++ {", array.FixedSize)
193-
value.p.Linef(" " + inner.Conversion)
193+
value.p.Linef(" %s", inner.Conversion)
194194
value.p.Linef("}")
195195

196196
value.p.Ascend()
@@ -239,12 +239,10 @@ func (conv *Converter) gocArrayConverter(value *ValueConverted) bool {
239239
)
240240

241241
value.p.Linef("for i := range %s {", value.In.Name)
242-
243242
// TODO: this generates *out because of value's inheritance, which is bad.
244243
// Do something. We can maybe use a hack and trim the star off.
245244
// Or maybe not? Maybe the converter should manually insert the star.
246-
247-
value.p.Linef(inner.Conversion)
245+
value.p.Linef(" %s", inner.Conversion)
248246
value.p.Linef("}")
249247

250248
value.p.Ascend()
@@ -270,7 +268,7 @@ func (conv *Converter) gocArrayConverter(value *ValueConverted) bool {
270268

271269
value.p.Linef("out := unsafe.Slice(%s.data, len(%s))", value.OutName, value.In.Name)
272270
value.p.Linef("for i := range %s {", value.In.Name)
273-
value.p.Linef(inner.Conversion)
271+
value.p.Linef(" %s", inner.Conversion)
274272
value.p.Linef("}")
275273

276274
value.p.Ascend()
@@ -327,7 +325,7 @@ func (conv *Converter) gocArrayConverter(value *ValueConverted) bool {
327325
value.p.Linef("var zero %s", inner.Out.Type)
328326
value.p.Linef("out[len(%s)] = zero", value.In.Name)
329327
value.p.Linef("for i := range %s {", value.In.Name)
330-
value.p.Linef(inner.Conversion)
328+
value.p.Linef(" %s", inner.Conversion)
331329
value.p.Linef("}")
332330

333331
value.p.Ascend()
@@ -375,8 +373,8 @@ func (conv *Converter) gocConvertNested(value *ValueConverted) bool {
375373
// faster than appending.
376374
value.p.Linef("for i := len(%s)-1; i >= 0; i-- {", value.InNamePtr(0))
377375
value.p.Linef(" src := %s[i]", value.InNamePtr(0))
378-
value.p.Linef(inner.Out.Declare)
379-
value.p.Linef(inner.Conversion)
376+
value.p.Linef(" %s", inner.Out.Declare)
377+
value.p.Linef(" %s", inner.Conversion)
380378
value.p.Linef(
381379
"%s = C.%s(%[1]s, C.gpointer(unsafe.Pointer(dst)))",
382380
value.Out.Set, prependFn)
@@ -419,10 +417,10 @@ func (conv *Converter) gocConvertNested(value *ValueConverted) bool {
419417
"%s = C.g_hash_table_new_full(nil, nil, (*[0]byte)(C.free), (*[0]byte)(C.free))",
420418
value.Out.Set)
421419
value.p.Linef("for ksrc, vsrc := range %s {", value.In.Set)
422-
value.p.Linef(kt.Out.Declare)
423-
value.p.Linef(vt.Out.Declare)
424-
value.p.Linef(kt.Conversion)
425-
value.p.Linef(vt.Conversion)
420+
value.p.Linef(" %s", kt.Out.Declare)
421+
value.p.Linef(" %s", vt.Out.Declare)
422+
value.p.Linef(" %s", kt.Conversion)
423+
value.p.Linef(" %s", vt.Conversion)
426424
value.p.Linef(" C.g_hash_table_insert(%s, %s, %s)", value.Out.Set, kptr, vptr)
427425
value.p.Linef("}")
428426

0 commit comments

Comments
 (0)