Skip to content

Commit 0ed841e

Browse files
egonelbreolavloite
andauthored
fix(benchmarks): staticcheck errors (#325)
* fix(benchmarks): staticcheck errors * fix(benchmarks): fix formatting argument * chore(benchmarks/benchwrapper): regenerate protobuf * build: run staticchecks on benchmark folder --------- Co-authored-by: Knut Olav Løite <koloite@gmail.com>
1 parent 9d4f987 commit 0ed841e

File tree

7 files changed

+106
-134
lines changed

7 files changed

+106
-134
lines changed

.github/workflows/unit-tests.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,8 @@ jobs:
6161

6262
- name: staticcheck ./examples
6363
working-directory: ./examples
64-
run: staticcheck -checks "inherit,-U1000" ./...
64+
run: staticcheck -checks "inherit,-U1000" ./...
65+
66+
- name: staticcheck ./benchmarks
67+
working-directory: ./benchmarks
68+
run: staticcheck -checks "inherit,-U1000" ./...

benchmarks/benchwrapper/main.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,9 @@ func (s *server) Update(ctx context.Context, req *pb.UpdateQuery) (*pb.EmptyResp
118118
}
119119
for _, q := range req.Queries {
120120
_, err = tx.ExecContext(ctx, q)
121-
121+
if err != nil {
122+
log.Fatalf("failed to execute query: %v", err)
123+
}
122124
}
123125
// Run the active DML batch.
124126
if _, err := tx.ExecContext(ctx, "RUN BATCH"); err != nil {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
README.md
22
Regenerating protos
33
cd benchmarks/benchwrapper/proto
4-
protoc --go_out=plugins=grpc:. *.proto
4+
go generate .
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright 2024 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
// Package main wraps the client library in a gRPC interface that a benchmarker
16+
// can communicate through.
17+
package proto
18+
19+
//go:generate protoc --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative *.proto

benchmarks/benchwrapper/proto/spanner.pb.go

Lines changed: 29 additions & 116 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

benchmarks/benchwrapper/proto/spanner.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
syntax = "proto3";
1616

1717
package spanner_bench;
18-
option go_package = "./spanner_bench";
18+
option go_package = "./proto";
1919

2020

2121
message Singer {

0 commit comments

Comments
 (0)