Skip to content

Commit

Permalink
chore(spanner): regenerate proto files and fix tests (#10242)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
harshachinta authored May 22, 2024
1 parent 1fb0e64 commit fd4cfc2
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 48 deletions.
11 changes: 10 additions & 1 deletion spanner/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2463,7 +2463,16 @@ func TestIntegration_BasicTypes_ProtoColumns(t *testing.T) {
if want == nil {
want = test.val
}
gotp := reflect.New(reflect.TypeOf(want))

var gotp reflect.Value
switch want.(type) {
case proto.Message:
// We are passing a pointer of proto message in `want` due to `go vet` issue.
// Through the switch case, we are dereferencing the value so that we get proto message instead of its pointer.
gotp = reflect.New(reflect.TypeOf(want).Elem())
default:
gotp = reflect.New(reflect.TypeOf(want))
}
v := gotp.Interface()

switch nullValue := v.(type) {
Expand Down
Binary file modified spanner/testdata/protos/descriptors.pb
Binary file not shown.
85 changes: 40 additions & 45 deletions spanner/testdata/protos/singer.pb.go

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

4 changes: 2 additions & 2 deletions spanner/testdata/protos/singer.proto
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

syntax = "proto2";
syntax = "proto3";

package examples.spanner.music;
option go_package = "./";
option go_package = "protos/";

message SingerInfo {
optional int64 singer_id = 1;
Expand Down

0 comments on commit fd4cfc2

Please sign in to comment.