Skip to content

go.mod: update to grpc-gateway v2 #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ go 1.21.1
toolchain go1.21.3

require (
github.com/bazelbuild/rules_go v0.46.0
github.com/biogo/store v0.0.0-20201120204734-aad293a2328f
github.com/blevesearch/snowballstem v0.9.0
github.com/cockroachdb/apd/v3 v3.1.0
Expand All @@ -16,8 +15,8 @@ require (
github.com/dustin/go-humanize v1.0.0
github.com/gogo/protobuf v1.3.2
github.com/golang/geo v0.0.0-20210211234256-740aa86cb551
github.com/google/go-cmp v0.5.8
github.com/grpc-ecosystem/grpc-gateway v1.16.0
github.com/google/go-cmp v0.6.0
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1
github.com/lib/pq v1.10.6
github.com/pierrre/geohash v1.0.0
github.com/sasha-s/go-deadlock v0.3.1
Expand All @@ -34,17 +33,19 @@ require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/getsentry/sentry-go v0.12.0 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/kr/pretty v0.3.0 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rogpeppe/go-internal v1.8.1 // indirect
github.com/rogpeppe/go-internal v1.9.0 // indirect
github.com/twpayne/go-kml v1.5.2 // indirect
golang.org/x/mod v0.14.0 // indirect
golang.org/x/sys v0.15.0 // indirect
google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84 // indirect
google.golang.org/grpc v1.40.1 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
golang.org/x/net v0.20.0 // indirect
golang.org/x/sys v0.16.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240125205218-1f4bbc51befe // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240125205218-1f4bbc51befe // indirect
google.golang.org/grpc v1.61.0 // indirect
google.golang.org/protobuf v1.32.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
61 changes: 24 additions & 37 deletions go.sum

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,29 +1,27 @@
diff --git a/pkg/sql/sem/tree/type_name.go b/pkg/sql/sem/tree/type_name.go
index 898009a..5d4423a 100644
index a671b41..51e484b 100644
--- a/pkg/sql/sem/tree/type_name.go
+++ b/pkg/sql/sem/tree/type_name.go
@@ -56,8 +56,7 @@ func (t *TypeName) String() string {

@@ -48,7 +48,7 @@ func (t *TypeName) Format(ctx *FmtCtx) {
// SQLString implements the ResolvableTypeReference interface.
func (t *TypeName) SQLString() string {
- // FmtBareIdentifiers prevents the TypeName string from being wrapped in quotations.
// FmtBareIdentifiers prevents the TypeName string from being wrapped in quotations.
- return AsStringWithFlags(t, FmtBareIdentifiers)
+ return AsStringWithFlags(t, FmtSimple)
}

// FQString renders the type name in full, not omitting the prefix
@@ -250,14 +249,12 @@ func (node *ArrayTypeReference) Format(ctx *FmtCtx) {

func (t *TypeName) objectName() {}
@@ -240,13 +240,13 @@ func (node *ArrayTypeReference) Format(ctx *FmtCtx) {
// SQLString implements the ResolvableTypeReference interface.
func (node *ArrayTypeReference) SQLString() string {
- // FmtBareIdentifiers prevents the TypeName string from being wrapped in quotations.
// FmtBareIdentifiers prevents the TypeName string from being wrapped in quotations.
- return AsStringWithFlags(node, FmtBareIdentifiers)
+ return AsStringWithFlags(node, FmtSimple)
}

// SQLString implements the ResolvableTypeReference interface.
func (name *UnresolvedObjectName) SQLString() string {
- // FmtBareIdentifiers prevents the TypeName string from being wrapped in quotations.
// FmtBareIdentifiers prevents the TypeName string from being wrapped in quotations.
- return AsStringWithFlags(name, FmtBareIdentifiers)
+ return AsStringWithFlags(name, FmtSimple)
}
Expand Down
25 changes: 12 additions & 13 deletions patches/0004-fix-bazel-compl.patch
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
From d300afb062569278ff9e770b4f7e0ed0d84f6f82 Mon Sep 17 00:00:00 2001
From: Oliver Tan <otan@cockroachlabs.com>
Date: Mon, 15 May 2023 14:21:32 +1000
From fd8c124e5968547a82fecc92e6081fdd71a4b49a Mon Sep 17 00:00:00 2001
From: Jeremy Yang <jyang@cockroachlabs.com>
Date: Tue, 13 Feb 2024 10:17:56 -0800
Subject: [PATCH] fix bazel compilation for grunning

---
pkg/util/grunning/disabled.go | 5 -----
pkg/util/grunning/enabled.go | 28 ----------------------------
2 files changed, 33 deletions(-)
pkg/util/grunning/enabled.go | 27 ---------------------------
2 files changed, 32 deletions(-)
delete mode 100644 pkg/util/grunning/enabled.go

diff --git a/pkg/util/grunning/disabled.go b/pkg/util/grunning/disabled.go
index 7fdc2f0..89fcb2d 100644
index f175eb2..89fcb2d 100644
--- a/pkg/util/grunning/disabled.go
+++ b/pkg/util/grunning/disabled.go
@@ -8,11 +8,6 @@
Expand All @@ -19,18 +19,18 @@ index 7fdc2f0..89fcb2d 100644

-// See grunning.Supported() for an explanation behind this build tag.
-//
-//go:build freebsd || (linux && s390x) || !bazel
-// +build freebsd linux,s390x !bazel
-//go:build (linux && s390x) || !bazel
-// +build linux,s390x !bazel
-
package grunning

func grunningnanos() int64 { return 0 }
diff --git a/pkg/util/grunning/enabled.go b/pkg/util/grunning/enabled.go
deleted file mode 100644
index ab12aae..0000000
index f8cd1b5..0000000
--- a/pkg/util/grunning/enabled.go
+++ /dev/null
@@ -1,28 +0,0 @@
@@ -1,27 +0,0 @@
-// Copyright 2022 The Cockroach Authors.
-//
-// Use of this software is governed by the Business Source License
Expand All @@ -43,8 +43,7 @@ index ab12aae..0000000
-
-// See grunning.Supported() for an explanation behind this build tag.
-//
-//go:build !(freebsd || (linux && s390x) || !bazel)
-// +build !freebsd
-//go:build !((linux && s390x) || !bazel)
-// +build !linux !s390x
-// +build bazel
-
Expand All @@ -60,5 +59,5 @@ index ab12aae..0000000
-
-func supported() bool { return true }
--
2.39.2 (Apple Git-143)
2.38.1

58 changes: 58 additions & 0 deletions patches/0006-upgrade-grpc-gateway.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
From ec8f53eb035966d9545bf0250cba607028759f59 Mon Sep 17 00:00:00 2001
From: Jeremy Yang <[email protected]>
Date: Tue, 13 Feb 2024 09:41:51 -0800
Subject: [PATCH] Update to grpc-gateway v2

This commit applies the changes from https://github.com/cockroachdb/cockroachdb-parser/pull/9
on top of the 23.2 snapshot.
---
pkg/util/protoutil/jsonpb_marshal.go | 4 +-
pkg/util/protoutil/marshaler.go | 4 +-

diff --git a/pkg/util/protoutil/jsonpb_marshal.go b/pkg/util/protoutil/jsonpb_marshal.go
index cd02994..22aa5c2 100644
--- a/pkg/util/protoutil/jsonpb_marshal.go
+++ b/pkg/util/protoutil/jsonpb_marshal.go
@@ -20,7 +20,7 @@ import (
"github.com/cockroachdb/errors"
"github.com/gogo/protobuf/jsonpb"
"github.com/gogo/protobuf/proto"
- gwruntime "github.com/grpc-ecosystem/grpc-gateway/runtime"
+ gwruntime "github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
)

var _ gwruntime.Marshaler = (*JSONPb)(nil)
@@ -31,7 +31,7 @@ var typeProtoMessage = reflect.TypeOf((*proto.Message)(nil)).Elem()
type JSONPb jsonpb.Marshaler

// ContentType implements gwruntime.Marshaler.
-func (*JSONPb) ContentType() string {
+func (*JSONPb) ContentType(_ interface{}) string {
// NB: This is the same as httputil.JSONContentType which we can't use due to
// an import cycle.
const JSONContentType = "application/json"
diff --git a/pkg/util/protoutil/marshaler.go b/pkg/util/protoutil/marshaler.go
index 6d835ae..7dfae1e 100644
--- a/pkg/util/protoutil/marshaler.go
+++ b/pkg/util/protoutil/marshaler.go
@@ -15,7 +15,7 @@ import (

"github.com/cockroachdb/errors"
"github.com/gogo/protobuf/proto"
- gwruntime "github.com/grpc-ecosystem/grpc-gateway/runtime"
+ gwruntime "github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
)

var _ gwruntime.Marshaler = (*ProtoPb)(nil)
@@ -24,7 +24,7 @@ var _ gwruntime.Marshaler = (*ProtoPb)(nil)
type ProtoPb struct{}

// ContentType implements gwruntime.Marshaler.
-func (*ProtoPb) ContentType() string {
+func (*ProtoPb) ContentType(_ interface{}) string {
// NB: This is the same as httputil.ProtoContentType which we can't use due
// to an import cycle.
const ProtoContentType = "application/x-protobuf"
--
2.38.1

Loading