Skip to content

Commit 911057d

Browse files
committed
go.mod: update to grpc-gateway v2
This commit takes the changes from #9 and applies them as a patch on top of new snapshots until we resolve the dependency issues.
1 parent 4168c29 commit 911057d

16 files changed

+855
-779
lines changed

go.mod

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ go 1.21.1
55
toolchain go1.21.3
66

77
require (
8-
github.com/bazelbuild/rules_go v0.46.0
98
github.com/biogo/store v0.0.0-20201120204734-aad293a2328f
109
github.com/blevesearch/snowballstem v0.9.0
1110
github.com/cockroachdb/apd/v3 v3.1.0
@@ -16,8 +15,8 @@ require (
1615
github.com/dustin/go-humanize v1.0.0
1716
github.com/gogo/protobuf v1.3.2
1817
github.com/golang/geo v0.0.0-20210211234256-740aa86cb551
19-
github.com/google/go-cmp v0.5.8
20-
github.com/grpc-ecosystem/grpc-gateway v1.16.0
18+
github.com/google/go-cmp v0.6.0
19+
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1
2120
github.com/lib/pq v1.10.6
2221
github.com/pierrre/geohash v1.0.0
2322
github.com/sasha-s/go-deadlock v0.3.1
@@ -34,17 +33,19 @@ require (
3433
github.com/davecgh/go-spew v1.1.1 // indirect
3534
github.com/getsentry/sentry-go v0.12.0 // indirect
3635
github.com/golang/protobuf v1.5.3 // indirect
37-
github.com/kr/pretty v0.3.0 // indirect
36+
github.com/kr/pretty v0.3.1 // indirect
3837
github.com/kr/text v0.2.0 // indirect
3938
github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 // indirect
4039
github.com/pkg/errors v0.9.1 // indirect
4140
github.com/pmezard/go-difflib v1.0.0 // indirect
42-
github.com/rogpeppe/go-internal v1.8.1 // indirect
41+
github.com/rogpeppe/go-internal v1.9.0 // indirect
4342
github.com/twpayne/go-kml v1.5.2 // indirect
4443
golang.org/x/mod v0.14.0 // indirect
45-
golang.org/x/sys v0.15.0 // indirect
46-
google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84 // indirect
47-
google.golang.org/grpc v1.40.1 // indirect
48-
google.golang.org/protobuf v1.31.0 // indirect
49-
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
44+
golang.org/x/net v0.20.0 // indirect
45+
golang.org/x/sys v0.16.0 // indirect
46+
google.golang.org/genproto/googleapis/api v0.0.0-20240125205218-1f4bbc51befe // indirect
47+
google.golang.org/genproto/googleapis/rpc v0.0.0-20240125205218-1f4bbc51befe // indirect
48+
google.golang.org/grpc v1.61.0 // indirect
49+
google.golang.org/protobuf v1.32.0 // indirect
50+
gopkg.in/yaml.v3 v3.0.1 // indirect
5051
)

go.sum

Lines changed: 24 additions & 37 deletions
Large diffs are not rendered by default.

patches/0002-fix-quote-names.sql renamed to patches/0002-fix-quote-names.patch

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,27 @@
11
diff --git a/pkg/sql/sem/tree/type_name.go b/pkg/sql/sem/tree/type_name.go
2-
index 898009a..5d4423a 100644
2+
index a671b41..51e484b 100644
33
--- a/pkg/sql/sem/tree/type_name.go
44
+++ b/pkg/sql/sem/tree/type_name.go
5-
@@ -56,8 +56,7 @@ func (t *TypeName) String() string {
6-
5+
@@ -48,7 +48,7 @@ func (t *TypeName) Format(ctx *FmtCtx) {
76
// SQLString implements the ResolvableTypeReference interface.
87
func (t *TypeName) SQLString() string {
9-
- // FmtBareIdentifiers prevents the TypeName string from being wrapped in quotations.
8+
// FmtBareIdentifiers prevents the TypeName string from being wrapped in quotations.
109
- return AsStringWithFlags(t, FmtBareIdentifiers)
1110
+ return AsStringWithFlags(t, FmtSimple)
1211
}
1312

14-
// FQString renders the type name in full, not omitting the prefix
15-
@@ -250,14 +249,12 @@ func (node *ArrayTypeReference) Format(ctx *FmtCtx) {
16-
13+
func (t *TypeName) objectName() {}
14+
@@ -240,13 +240,13 @@ func (node *ArrayTypeReference) Format(ctx *FmtCtx) {
1715
// SQLString implements the ResolvableTypeReference interface.
1816
func (node *ArrayTypeReference) SQLString() string {
19-
- // FmtBareIdentifiers prevents the TypeName string from being wrapped in quotations.
17+
// FmtBareIdentifiers prevents the TypeName string from being wrapped in quotations.
2018
- return AsStringWithFlags(node, FmtBareIdentifiers)
2119
+ return AsStringWithFlags(node, FmtSimple)
2220
}
2321

2422
// SQLString implements the ResolvableTypeReference interface.
2523
func (name *UnresolvedObjectName) SQLString() string {
26-
- // FmtBareIdentifiers prevents the TypeName string from being wrapped in quotations.
24+
// FmtBareIdentifiers prevents the TypeName string from being wrapped in quotations.
2725
- return AsStringWithFlags(name, FmtBareIdentifiers)
2826
+ return AsStringWithFlags(name, FmtSimple)
2927
}

patches/0004-fix-bazel-compl.patch

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
From d300afb062569278ff9e770b4f7e0ed0d84f6f82 Mon Sep 17 00:00:00 2001
2-
From: Oliver Tan <otan@cockroachlabs.com>
3-
Date: Mon, 15 May 2023 14:21:32 +1000
1+
From fd8c124e5968547a82fecc92e6081fdd71a4b49a Mon Sep 17 00:00:00 2001
2+
From: Jeremy Yang <jyang@cockroachlabs.com>
3+
Date: Tue, 13 Feb 2024 10:17:56 -0800
44
Subject: [PATCH] fix bazel compilation for grunning
55

66
---
77
pkg/util/grunning/disabled.go | 5 -----
8-
pkg/util/grunning/enabled.go | 28 ----------------------------
9-
2 files changed, 33 deletions(-)
8+
pkg/util/grunning/enabled.go | 27 ---------------------------
9+
2 files changed, 32 deletions(-)
1010
delete mode 100644 pkg/util/grunning/enabled.go
1111

1212
diff --git a/pkg/util/grunning/disabled.go b/pkg/util/grunning/disabled.go
13-
index 7fdc2f0..89fcb2d 100644
13+
index f175eb2..89fcb2d 100644
1414
--- a/pkg/util/grunning/disabled.go
1515
+++ b/pkg/util/grunning/disabled.go
1616
@@ -8,11 +8,6 @@
@@ -19,18 +19,18 @@ index 7fdc2f0..89fcb2d 100644
1919

2020
-// See grunning.Supported() for an explanation behind this build tag.
2121
-//
22-
-//go:build freebsd || (linux && s390x) || !bazel
23-
-// +build freebsd linux,s390x !bazel
22+
-//go:build (linux && s390x) || !bazel
23+
-// +build linux,s390x !bazel
2424
-
2525
package grunning
2626

2727
func grunningnanos() int64 { return 0 }
2828
diff --git a/pkg/util/grunning/enabled.go b/pkg/util/grunning/enabled.go
2929
deleted file mode 100644
30-
index ab12aae..0000000
30+
index f8cd1b5..0000000
3131
--- a/pkg/util/grunning/enabled.go
3232
+++ /dev/null
33-
@@ -1,28 +0,0 @@
33+
@@ -1,27 +0,0 @@
3434
-// Copyright 2022 The Cockroach Authors.
3535
-//
3636
-// Use of this software is governed by the Business Source License
@@ -43,8 +43,7 @@ index ab12aae..0000000
4343
-
4444
-// See grunning.Supported() for an explanation behind this build tag.
4545
-//
46-
-//go:build !(freebsd || (linux && s390x) || !bazel)
47-
-// +build !freebsd
46+
-//go:build !((linux && s390x) || !bazel)
4847
-// +build !linux !s390x
4948
-// +build bazel
5049
-
@@ -60,5 +59,5 @@ index ab12aae..0000000
6059
-
6160
-func supported() bool { return true }
6261
--
63-
2.39.2 (Apple Git-143)
62+
2.38.1
6463

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
From ec8f53eb035966d9545bf0250cba607028759f59 Mon Sep 17 00:00:00 2001
2+
From: Jeremy Yang <[email protected]>
3+
Date: Tue, 13 Feb 2024 09:41:51 -0800
4+
Subject: [PATCH] Update to grpc-gateway v2
5+
6+
This commit applies the changes from https://github.com/cockroachdb/cockroachdb-parser/pull/9
7+
on top of the 23.2 snapshot.
8+
---
9+
pkg/util/protoutil/jsonpb_marshal.go | 4 +-
10+
pkg/util/protoutil/marshaler.go | 4 +-
11+
12+
diff --git a/pkg/util/protoutil/jsonpb_marshal.go b/pkg/util/protoutil/jsonpb_marshal.go
13+
index cd02994..22aa5c2 100644
14+
--- a/pkg/util/protoutil/jsonpb_marshal.go
15+
+++ b/pkg/util/protoutil/jsonpb_marshal.go
16+
@@ -20,7 +20,7 @@ import (
17+
"github.com/cockroachdb/errors"
18+
"github.com/gogo/protobuf/jsonpb"
19+
"github.com/gogo/protobuf/proto"
20+
- gwruntime "github.com/grpc-ecosystem/grpc-gateway/runtime"
21+
+ gwruntime "github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
22+
)
23+
24+
var _ gwruntime.Marshaler = (*JSONPb)(nil)
25+
@@ -31,7 +31,7 @@ var typeProtoMessage = reflect.TypeOf((*proto.Message)(nil)).Elem()
26+
type JSONPb jsonpb.Marshaler
27+
28+
// ContentType implements gwruntime.Marshaler.
29+
-func (*JSONPb) ContentType() string {
30+
+func (*JSONPb) ContentType(_ interface{}) string {
31+
// NB: This is the same as httputil.JSONContentType which we can't use due to
32+
// an import cycle.
33+
const JSONContentType = "application/json"
34+
diff --git a/pkg/util/protoutil/marshaler.go b/pkg/util/protoutil/marshaler.go
35+
index 6d835ae..7dfae1e 100644
36+
--- a/pkg/util/protoutil/marshaler.go
37+
+++ b/pkg/util/protoutil/marshaler.go
38+
@@ -15,7 +15,7 @@ import (
39+
40+
"github.com/cockroachdb/errors"
41+
"github.com/gogo/protobuf/proto"
42+
- gwruntime "github.com/grpc-ecosystem/grpc-gateway/runtime"
43+
+ gwruntime "github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
44+
)
45+
46+
var _ gwruntime.Marshaler = (*ProtoPb)(nil)
47+
@@ -24,7 +24,7 @@ var _ gwruntime.Marshaler = (*ProtoPb)(nil)
48+
type ProtoPb struct{}
49+
50+
// ContentType implements gwruntime.Marshaler.
51+
-func (*ProtoPb) ContentType() string {
52+
+func (*ProtoPb) ContentType(_ interface{}) string {
53+
// NB: This is the same as httputil.ProtoContentType which we can't use due
54+
// to an import cycle.
55+
const ProtoContentType = "application/x-protobuf"
56+
--
57+
2.38.1
58+

0 commit comments

Comments
 (0)