Skip to content

Commit 6d3dd6d

Browse files
committed
all: fix linter errors
1. govet catched %q misuse 2. staticcheck catched deprecated spanner.SessionPoolConfig
1 parent 6c86d10 commit 6d3dd6d

8 files changed

Lines changed: 11 additions & 16 deletions

File tree

dashboard/app/aidb/crud.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -243,12 +243,7 @@ func dbClient(ctx context.Context) (*spanner.Client, error) {
243243
path := fmt.Sprintf("projects/%v/instances/%v/databases/%v",
244244
appID, Instance, Database)
245245
// We use background context for the client, so that it survives the request.
246-
client, err := spanner.NewClientWithConfig(context.Background(), path, spanner.ClientConfig{
247-
SessionPoolConfig: spanner.SessionPoolConfig{
248-
MinOpened: 1,
249-
MaxOpened: 20,
250-
},
251-
})
246+
client, err := spanner.NewClientWithConfig(context.Background(), path, spanner.ClientConfig{})
252247
if err != nil {
253248
return nil, err
254249
}

dashboard/app/email_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -950,7 +950,7 @@ func TestSubjectTitleParser(t *testing.T) {
950950
} else if title != test.outTitle {
951951
t.Fatalf("subj: %q, expected title=%q, got %q", test.inSubject, test.outTitle, title)
952952
} else if seq != test.outSeq {
953-
t.Fatalf("subj: %q, expected seq=%q, got %q", test.inSubject, test.outSeq, seq)
953+
t.Fatalf("subj: %q, expected seq=%d, got %d", test.inSubject, test.outSeq, seq)
954954
}
955955
}
956956
}

pkg/ast/format.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ func fmtExpressionRec(sb *strings.Builder, t *Type, parentPrio int) {
274274
case OperatorOr:
275275
sb.WriteString("||")
276276
default:
277-
panic(fmt.Sprintf("unknown operator %q", be.Operator))
277+
panic(fmt.Sprintf("unknown operator %v", be.Operator))
278278
}
279279
sb.WriteByte(' ')
280280
fmtExpressionRec(sb, be.Right, myPrio)
@@ -289,7 +289,7 @@ func operatorPrio(op Operator) int {
289289
return info.prio
290290
}
291291
}
292-
panic(fmt.Sprintf("unknown operator %q", op))
292+
panic(fmt.Sprintf("unknown operator %v", op))
293293
}
294294

295295
func comma(i int, or string) string {

pkg/ast/scanner.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ func init() {
8282
if tok == tokIllegal {
8383
continue
8484
}
85-
tok2str[tok] = fmt.Sprintf("%q", ch)
85+
tok2str[tok] = fmt.Sprintf("%q", rune(ch))
8686
}
8787
}
8888

pkg/compiler/gen.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ func (comp *compiler) genSyscall(n *ast.Call, argSizes []uint64) *prog.Syscall {
144144
case flagAttr:
145145
fld.SetBool(val != 0)
146146
default:
147-
panic(fmt.Sprintf("unexpected attrDesc type: %q", desc.Type))
147+
panic(fmt.Sprintf("unexpected attrDesc type: %v", desc.Type))
148148
}
149149
}
150150
for desc, val := range stringAttrs {
@@ -153,7 +153,7 @@ func (comp *compiler) genSyscall(n *ast.Call, argSizes []uint64) *prog.Syscall {
153153
case stringAttr:
154154
fld.SetString(val)
155155
default:
156-
panic(fmt.Sprintf("unexpected attrDesc type: %q", desc.Type))
156+
panic(fmt.Sprintf("unexpected attrDesc type: %v", desc.Type))
157157
}
158158
}
159159
fields, _ := comp.genFieldArray(n.Args, argSizes)

pkg/cover/backend/gvisor.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,10 @@ func gvisorSymbolize(bin, srcDir string) ([]*Frame, error) {
9797
func gvisorParseLine(s *bufio.Scanner) (*Frame, error) {
9898
pc, err := strconv.ParseUint(s.Text(), 0, 64)
9999
if err != nil {
100-
return nil, fmt.Errorf("read pc %q, but no line info", pc)
100+
return nil, fmt.Errorf("read pc %x, but no line info", pc)
101101
}
102102
if !s.Scan() {
103-
return nil, fmt.Errorf("read pc %q, but no line info", pc)
103+
return nil, fmt.Errorf("read pc %x, but no line info", pc)
104104
}
105105
match := gvisorLineRe.FindStringSubmatch(s.Text())
106106
if match == nil {

pkg/instance/instance_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ func TestExecprogCmd(t *testing.T) {
8383
t.Errorf("bad sandbox: %q, want: %q", *flagSandbox, "namespace")
8484
}
8585
if *flagSandboxArg != 3 {
86-
t.Errorf("bad sandbox_arg: %q, want: %q", *flagSandboxArg, 3)
86+
t.Errorf("bad sandbox_arg: %v, want: %v", *flagSandboxArg, 3)
8787
}
8888
if *flagSignal {
8989
t.Errorf("bad signal: %v, want: %v", *flagSignal, false)

prog/expr.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func (bo BinaryExpression) Evaluate(finder ArgFinder) (uint64, bool) {
3636
}
3737
return 0, true
3838
}
39-
panic(fmt.Sprintf("unknown operator %q", bo.Operator))
39+
panic(fmt.Sprintf("unknown operator %v", bo.Operator))
4040
}
4141

4242
func (v *Value) Evaluate(finder ArgFinder) (uint64, bool) {

0 commit comments

Comments
 (0)