Skip to content

Commit fd4cfc2

Browse files
authored
chore(spanner): regenerate proto files and fix tests (#10242)
* fix(spanner): fix arguments used in integration test * fix(spanner): regenerate proto files with latest protoc version * fix(spanner): regenerate proto files with latest protoc version * fix(spanner): fix vet * fix(spanner): fix vet * fix(spanner): use switch case to handle pointer
1 parent 1fb0e64 commit fd4cfc2

4 files changed

Lines changed: 52 additions & 48 deletions

File tree

spanner/integration_test.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2463,7 +2463,16 @@ func TestIntegration_BasicTypes_ProtoColumns(t *testing.T) {
24632463
if want == nil {
24642464
want = test.val
24652465
}
2466-
gotp := reflect.New(reflect.TypeOf(want))
2466+
2467+
var gotp reflect.Value
2468+
switch want.(type) {
2469+
case proto.Message:
2470+
// We are passing a pointer of proto message in `want` due to `go vet` issue.
2471+
// Through the switch case, we are dereferencing the value so that we get proto message instead of its pointer.
2472+
gotp = reflect.New(reflect.TypeOf(want).Elem())
2473+
default:
2474+
gotp = reflect.New(reflect.TypeOf(want))
2475+
}
24672476
v := gotp.Interface()
24682477

24692478
switch nullValue := v.(type) {
94 Bytes
Binary file not shown.

spanner/testdata/protos/singer.pb.go

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

spanner/testdata/protos/singer.proto

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
syntax = "proto2";
17+
syntax = "proto3";
1818

1919
package examples.spanner.music;
20-
option go_package = "./";
20+
option go_package = "protos/";
2121

2222
message SingerInfo {
2323
optional int64 singer_id = 1;

0 commit comments

Comments
 (0)