Skip to content

Commit

Permalink
Merge pull request #2291 from yarpc/vitalii/release
Browse files Browse the repository at this point in the history
Preparing release v1.73.2
  • Loading branch information
biosvs authored Sep 9, 2024
2 parents 4ebe8a4 + c1f7d96 commit 23485b3
Show file tree
Hide file tree
Showing 33 changed files with 84 additions and 29 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

=======
## [1.73.2] - 2024-09-09
### Added
- `OriginalHeader` accessor in `encoding.Call` to get an original header value for a request from context object with zero-copy, as opposed to accessing it via `OriginalHeaders()`

## [1.73.1] - 2024-08-26
### Changed
- Updated most of the dependencies in go.mod to a newer versions.
Expand Down Expand Up @@ -1512,6 +1516,7 @@ This release requires regeneration of ThriftRW code.
## 0.1.0 - 2016-08-31
- Initial release.
[1.73.2]: https://github.com/yarpc/yarpc-go/compare/v1.73.1...1.73.2
[1.73.1]: https://github.com/yarpc/yarpc-go/compare/v1.73.0...1.73.1
[1.73.0]: https://github.com/yarpc/yarpc-go/compare/v1.72.1...1.73.0
[1.72.1]: https://github.com/yarpc/yarpc-go/compare/v1.72.0...1.72.1
Expand Down
15 changes: 15 additions & 0 deletions api/encoding/call.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,21 @@ func (c *Call) Header(k string) string {
return ""
}

// OriginalHeader returns the value of the given request header provided with the
// request. The getter is suitable for transport like TChannel that hides
// certain headers by default eg: the ones starting with $
func (c *Call) OriginalHeader(k string) string {
if c == nil {
return ""
}

if v, ok := c.md.Headers().OriginalItems()[k]; ok {
return v
}

return ""
}

// OriginalHeaders returns a copy of the given request headers provided with the request.
// The header key are not canonicalized and suitable for case-sensitive transport like TChannel.
func (c *Call) OriginalHeaders() map[string]string {
Expand Down
5 changes: 5 additions & 0 deletions api/encoding/call_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ func TestNilCall(t *testing.T) {
assert.Equal(t, "", call.RoutingDelegate())
assert.Equal(t, "", call.CallerProcedure())
assert.Equal(t, "", call.Header("foo"))
assert.Equal(t, "", call.OriginalHeader("foo"))
assert.Empty(t, call.HeaderNames())
assert.Nil(t, call.OriginalHeaders())

Expand Down Expand Up @@ -76,6 +77,8 @@ func TestReadFromRequest(t *testing.T) {
assert.Equal(t, "rk", call.RoutingKey())
assert.Equal(t, "rd", call.RoutingDelegate())
assert.Equal(t, "bar", call.Header("foo"))
assert.Equal(t, "bar", call.OriginalHeader("foo"))
assert.Equal(t, "Bar", call.OriginalHeader("Foo"))
assert.Equal(t, map[string]string{"Foo": "Bar", "foo": "bar"}, call.OriginalHeaders())
assert.Equal(t, "cp", call.CallerProcedure())
assert.Len(t, call.HeaderNames(), 1)
Expand Down Expand Up @@ -113,6 +116,8 @@ func TestReadFromRequestMeta(t *testing.T) {
assert.Equal(t, "rd", call.RoutingDelegate())
assert.Equal(t, "cp", call.CallerProcedure())
assert.Equal(t, "bar", call.Header("foo"))
assert.Equal(t, "bar", call.OriginalHeader("foo"))
assert.Equal(t, "Bar", call.OriginalHeader("Foo"))
assert.Equal(t, map[string]string{"Foo": "Bar", "foo": "bar"}, call.OriginalHeaders())
assert.Len(t, call.HeaderNames(), 1)

Expand Down
7 changes: 7 additions & 0 deletions call.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,13 @@ func (c *Call) Header(k string) string {
return (*encoding.Call)(c).Header(k)
}

// OriginalHeader returns the value of the given request header provided with the
// request. The getter is suitable for transport like TChannel that hides
// certain headers by default eg: the ones starting with $
func (c *Call) OriginalHeader(k string) string {
return (*encoding.Call)(c).OriginalHeader(k)
}

// OriginalHeaders returns a copy of the given request headers provided with the request.
// The header key are not canonicalized and suitable for case-sensitive transport like TChannel.
func (c *Call) OriginalHeaders() map[string]string {
Expand Down
2 changes: 2 additions & 0 deletions call_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ func TestCallFromContext(t *testing.T) {
assert.Equal(t, transport.Encoding("baz"), call.Encoding())
assert.Equal(t, "hello", call.Procedure())
assert.Equal(t, "bar", call.Header("foo"))
assert.Equal(t, "bar", call.OriginalHeader("foo"))
assert.Equal(t, "Bar", call.OriginalHeader("Foo"))
assert.Equal(t, map[string]string{"Foo": "Bar", "foo": "bar"}, call.OriginalHeaders())
assert.Equal(t, []string{"foo"}, call.HeaderNames())
assert.Equal(t, "one", call.ShardKey())
Expand Down
4 changes: 2 additions & 2 deletions compressor/grpc/grpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ package yarpcgrpccompressor_test
import (
"testing"

"go.uber.org/yarpc/compressor/grpc"
"go.uber.org/yarpc/compressor/gzip"
yarpcgrpccompressor "go.uber.org/yarpc/compressor/grpc"
yarpcgzip "go.uber.org/yarpc/compressor/gzip"
"google.golang.org/grpc/encoding"
)

Expand Down
2 changes: 1 addition & 1 deletion compressor/gzip/gzip_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.uber.org/yarpc/compressor/gzip"
yarpcgzip "go.uber.org/yarpc/compressor/gzip"
)

// This should be compressible:
Expand Down
2 changes: 1 addition & 1 deletion compressor/snappy/snappy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.uber.org/yarpc/compressor/snappy"
yarpcsnappy "go.uber.org/yarpc/compressor/snappy"
)

// This should be compressible:
Expand Down
2 changes: 1 addition & 1 deletion encoding/protobuf/v2/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ package v2
import (
"errors"
"fmt"
"google.golang.org/protobuf/encoding/prototext"
"strings"

"github.com/golang/protobuf/ptypes/any"
Expand All @@ -32,6 +31,7 @@ import (
"go.uber.org/yarpc/yarpcerrors"
rpc_status "google.golang.org/genproto/googleapis/rpc/status"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/encoding/prototext"
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/types/known/anypb"
)
Expand Down
2 changes: 1 addition & 1 deletion encoding/protobuf/v2/error_external_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
"github.com/golang/protobuf/ptypes/wrappers"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.uber.org/yarpc/encoding/protobuf/v2"
v2 "go.uber.org/yarpc/encoding/protobuf/v2"
"go.uber.org/yarpc/yarpcerrors"
"google.golang.org/protobuf/proto"
)
Expand Down
2 changes: 1 addition & 1 deletion encoding/protobuf/v2/error_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import (
"go.uber.org/yarpc/api/transport"
"go.uber.org/yarpc/encoding/json"
"go.uber.org/yarpc/encoding/protobuf/internal/testpb/v2"
"go.uber.org/yarpc/encoding/protobuf/v2"
v2 "go.uber.org/yarpc/encoding/protobuf/v2"
"go.uber.org/yarpc/encoding/raw"
"go.uber.org/yarpc/transport/grpc"
"go.uber.org/yarpc/yarpcerrors"
Expand Down
2 changes: 1 addition & 1 deletion encoding/protobuf/v2/inbound_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
"go.uber.org/yarpc/api/transport"
"go.uber.org/yarpc/api/transport/transporttest"
"go.uber.org/yarpc/encoding/protobuf/internal/testpb/v2"
"go.uber.org/yarpc/encoding/protobuf/v2"
v2 "go.uber.org/yarpc/encoding/protobuf/v2"
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/types/known/anypb"
)
Expand Down
5 changes: 3 additions & 2 deletions encoding/protobuf/v2/marshal.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@
package v2

import (
"io"
"sync"

"go.uber.org/yarpc/api/transport"
"go.uber.org/yarpc/internal/bufferpool"
"go.uber.org/yarpc/yarpcerrors"
"google.golang.org/protobuf/encoding/protojson"
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/reflect/protoregistry"
"io"
"sync"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion encoding/protobuf/v2/observability_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import (
"go.uber.org/yarpc"
"go.uber.org/yarpc/api/transport"
"go.uber.org/yarpc/encoding/protobuf/internal/testpb/v2"
"go.uber.org/yarpc/encoding/protobuf/v2"
v2 "go.uber.org/yarpc/encoding/protobuf/v2"
"go.uber.org/yarpc/internal/testutils"
"go.uber.org/yarpc/transport/grpc"
"go.uber.org/yarpc/yarpcerrors"
Expand Down
2 changes: 1 addition & 1 deletion encoding/protobuf/v2/outbound_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (
"github.com/stretchr/testify/require"
"go.uber.org/yarpc/api/transport"
"go.uber.org/yarpc/encoding/protobuf/internal/testpb/v2"
"go.uber.org/yarpc/encoding/protobuf/v2"
v2 "go.uber.org/yarpc/encoding/protobuf/v2"
"go.uber.org/yarpc/yarpctest"
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/reflect/protoreflect"
Expand Down
2 changes: 1 addition & 1 deletion encoding/protobuf/v2/stream_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import (
"go.uber.org/yarpc"
"go.uber.org/yarpc/api/transport"
"go.uber.org/yarpc/encoding/protobuf/internal/testpb/v2"
"go.uber.org/yarpc/encoding/protobuf/v2"
v2 "go.uber.org/yarpc/encoding/protobuf/v2"
"go.uber.org/yarpc/internal/clientconfig"
"go.uber.org/yarpc/peer"
"go.uber.org/yarpc/peer/hostport"
Expand Down
6 changes: 6 additions & 0 deletions etc/make/deps.mk
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ RAGEL_VERSION := 6.10
ERRCHECK_VERSION := 1.7.0
GOLINT_VERSION := 0.0.0-20210508222113-6edffad5e616
STATICHCHECK_VERSION := 0.4.7
GOIMPORTS_VERSION := 0.24.0

THRIFT_OS := $(UNAME_OS)
PROTOC_OS := $(UNAME_OS)
Expand Down Expand Up @@ -89,6 +90,10 @@ $(BIN)/staticcheck:
@mkdir -p $(BIN)
GOBIN=$(BIN) go install "honnef.co/go/tools/cmd/staticcheck@v$(STATICHCHECK_VERSION)"

$(BIN)/goimports:
@mkdir -p $(BIN)
GOBIN=$(BIN) go install "golang.org/x/tools/cmd/goimports@v$(GOIMPORTS_VERSION)"

define generatedeprule
GEN_BINS += $(BIN)/$(shell basename $1)
endef
Expand All @@ -112,6 +117,7 @@ THRIFTRW = $(BIN)/thriftrw
GOLINT = $(BIN)/golint
ERRCHECK = $(BIN)/errcheck
STATICCHECK = $(BIN)/staticcheck
GOIMPORTS = $(BIN)/goimports

.PHONY: predeps
predeps: $(THRIFT) $(PROTOC) $(RAGEL)
Expand Down
15 changes: 14 additions & 1 deletion etc/make/local.mk
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,19 @@ errcheck: $(ERRCHECK) __eval_packages __eval_go_files ## check errcheck
@PATH=$(BIN):$$PATH errcheck $(ERRCHECK_FLAGS) $(PACKAGES) 2>&1 | $(FILTER_LINT) | $(FILTER_ERRCHECK) > $(ERRCHECK_LOG) || true
@[ ! -s "$(ERRCHECK_LOG)" ] || (echo "errcheck failed:" | cat - $(ERRCHECK_LOG) && false)

.PHONY: goimports
goimports: $(GOIMPORTS) __eval_packages __eval_go_files
@echo "goimports"
$(eval GOIMPORTS_LOG := $(shell mktemp -t goimports.XXXXX))
@PATH=$(BIN):$$PATH goimports -l $(GO_FILES) | $(FILTER_LINT) >> $(GOIMPORTS_LOG) || true
@[ ! -s "$(GOIMPORTS_LOG)" ] || (echo "goimports failed (run 'make goimports-fix'):" | cat - $(GOIMPORTS_LOG) && false)

.PHONY: goimports-fix
goimports-fix: $(GOIMPORTS) __eval_packages __eval_go_files
@echo "goimports-fix"
$(eval TARGET_FILES := $(shell PATH=$(BIN):$$PATH goimports -l $(GO_FILES) | $(FILTER_LINT)))
@PATH=$(BIN):$$PATH goimports -w $(TARGET_FILES)

.PHONY: verifyversion
verifyversion: ## verify the version in the changelog is the same as in version.go
@echo "verifyversion"
Expand Down Expand Up @@ -138,7 +151,7 @@ verifycodecovignores: ## verify that .codecov.yml contains all .nocover packages
done

.PHONY: basiclint
basiclint: gofmt govet golint staticcheck errcheck # run gofmt govet golint staticcheck errcheck
basiclint: gofmt govet golint staticcheck errcheck goimports # run gofmt govet golint staticcheck errcheck

.PHONY: lint
lint: basiclint generatenodiff nogogenerate verifyversion verifycodecovignores ## run all linters
Expand Down
2 changes: 1 addition & 1 deletion internal/protoplugin-v2/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
"path"
"text/template"

"github.com/golang/protobuf/protoc-gen-go/plugin"
plugin_go "github.com/golang/protobuf/protoc-gen-go/plugin"
"google.golang.org/protobuf/proto"
)

Expand Down
2 changes: 1 addition & 1 deletion internal/protoplugin-v2/multi_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"fmt"
"sort"

"github.com/golang/protobuf/protoc-gen-go/plugin"
plugin_go "github.com/golang/protobuf/protoc-gen-go/plugin"
"go.uber.org/multierr"
)

Expand Down
2 changes: 1 addition & 1 deletion internal/protoplugin-v2/multi_runner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"errors"
"testing"

"github.com/golang/protobuf/protoc-gen-go/plugin"
plugin_go "github.com/golang/protobuf/protoc-gen-go/plugin"
"github.com/stretchr/testify/assert"
"go.uber.org/multierr"
"google.golang.org/protobuf/proto"
Expand Down
2 changes: 1 addition & 1 deletion internal/protoplugin-v2/protoplugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import (
"text/template"

"github.com/golang/protobuf/protoc-gen-go/descriptor"
"github.com/golang/protobuf/protoc-gen-go/plugin"
plugin_go "github.com/golang/protobuf/protoc-gen-go/plugin"
"google.golang.org/protobuf/proto"
)

Expand Down
2 changes: 1 addition & 1 deletion internal/protoplugin-v2/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
"strings"

"github.com/golang/protobuf/protoc-gen-go/descriptor"
"github.com/golang/protobuf/protoc-gen-go/plugin"
plugin_go "github.com/golang/protobuf/protoc-gen-go/plugin"
)

type registry struct {
Expand Down
2 changes: 1 addition & 1 deletion internal/protoplugin-v2/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"strings"
"text/template"

"github.com/golang/protobuf/protoc-gen-go/plugin"
plugin_go "github.com/golang/protobuf/protoc-gen-go/plugin"
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/types/pluginpb"
)
Expand Down
2 changes: 1 addition & 1 deletion internal/protoplugin/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
"text/template"

"github.com/gogo/protobuf/proto"
"github.com/gogo/protobuf/protoc-gen-gogo/plugin"
plugin_go "github.com/gogo/protobuf/protoc-gen-gogo/plugin"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion internal/protoplugin/multi_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"fmt"
"sort"

"github.com/gogo/protobuf/protoc-gen-gogo/plugin"
plugin_go "github.com/gogo/protobuf/protoc-gen-gogo/plugin"
"go.uber.org/multierr"
)

Expand Down
2 changes: 1 addition & 1 deletion internal/protoplugin/multi_runner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"testing"

"github.com/gogo/protobuf/proto"
"github.com/gogo/protobuf/protoc-gen-gogo/plugin"
plugin_go "github.com/gogo/protobuf/protoc-gen-gogo/plugin"
"github.com/stretchr/testify/assert"
"go.uber.org/multierr"
)
Expand Down
2 changes: 1 addition & 1 deletion internal/protoplugin/protoplugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ import (
"github.com/gogo/protobuf/proto"
"github.com/gogo/protobuf/protoc-gen-gogo/descriptor"
gogogen "github.com/gogo/protobuf/protoc-gen-gogo/generator"
"github.com/gogo/protobuf/protoc-gen-gogo/plugin"
plugin_go "github.com/gogo/protobuf/protoc-gen-gogo/plugin"
)

// Do is a helper function for protobuf plugins.
Expand Down
2 changes: 1 addition & 1 deletion internal/protoplugin/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
"strings"

"github.com/gogo/protobuf/protoc-gen-gogo/descriptor"
"github.com/gogo/protobuf/protoc-gen-gogo/plugin"
plugin_go "github.com/gogo/protobuf/protoc-gen-gogo/plugin"
)

type registry struct {
Expand Down
2 changes: 1 addition & 1 deletion internal/protoplugin/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"text/template"

"github.com/gogo/protobuf/proto"
"github.com/gogo/protobuf/protoc-gen-gogo/plugin"
plugin_go "github.com/gogo/protobuf/protoc-gen-gogo/plugin"
)

type runner struct {
Expand Down
2 changes: 1 addition & 1 deletion transport/grpc/globals_for_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
package grpc

import (
"go.uber.org/yarpc/compressor/grpc"
yarpcgrpccompressor "go.uber.org/yarpc/compressor/grpc"
"go.uber.org/yarpc/yarpcconfig"
"google.golang.org/grpc/encoding"
)
Expand Down
2 changes: 1 addition & 1 deletion version.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@
package yarpc // import "go.uber.org/yarpc"

// Version is the current version of YARPC.
const Version = "1.73.1"
const Version = "1.73.2"
3 changes: 2 additions & 1 deletion yarpcerrors/yarpcerrorclassifier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@
package yarpcerrors

import (
"github.com/stretchr/testify/assert"
"testing"

"github.com/stretchr/testify/assert"
)

func TestGetFaultTypeFromErrorForClientErrors(t *testing.T) {
Expand Down

0 comments on commit 23485b3

Please sign in to comment.