Skip to content

Commit

Permalink
fix(benchmarks): staticcheck errors (#325)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
egonelbre and olavloite authored Nov 22, 2024
1 parent 9d4f987 commit 0ed841e
Show file tree
Hide file tree
Showing 7 changed files with 106 additions and 134 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,8 @@ jobs:

- name: staticcheck ./examples
working-directory: ./examples
run: staticcheck -checks "inherit,-U1000" ./...
run: staticcheck -checks "inherit,-U1000" ./...

- name: staticcheck ./benchmarks
working-directory: ./benchmarks
run: staticcheck -checks "inherit,-U1000" ./...
4 changes: 3 additions & 1 deletion benchmarks/benchwrapper/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@ func (s *server) Update(ctx context.Context, req *pb.UpdateQuery) (*pb.EmptyResp
}
for _, q := range req.Queries {
_, err = tx.ExecContext(ctx, q)

if err != nil {
log.Fatalf("failed to execute query: %v", err)
}
}
// Run the active DML batch.
if _, err := tx.ExecContext(ctx, "RUN BATCH"); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/benchwrapper/proto/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
README.md
Regenerating protos
cd benchmarks/benchwrapper/proto
protoc --go_out=plugins=grpc:. *.proto
go generate .
19 changes: 19 additions & 0 deletions benchmarks/benchwrapper/proto/gen.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright 2024 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Package main wraps the client library in a gRPC interface that a benchmarker
// can communicate through.
package proto

//go:generate protoc --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative *.proto
145 changes: 29 additions & 116 deletions benchmarks/benchwrapper/proto/spanner.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion benchmarks/benchwrapper/proto/spanner.proto
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
syntax = "proto3";

package spanner_bench;
option go_package = "./spanner_bench";
option go_package = "./proto";


message Singer {
Expand Down
Loading

0 comments on commit 0ed841e

Please sign in to comment.