diff --git a/internal/iface/iface.go b/internal/iface/iface.go deleted file mode 100644 index bf7a2e7f..00000000 --- a/internal/iface/iface.go +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) 2021 Uber Technologies, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -package iface - -// Private will be used to make interfaces defined in ThriftRW private. -// Example usage: -// -// import ".../internal/iface" -// -// type PrivateInterface interface { -// iface.Private -// -// Method1() -// } -type Private interface{ private() } - -// Impl is the implementation for the private interface and should also be -// referenced. -// Example usage: -// -// import ".../internal/iface" -// -// type PrivateImpl struct { -// iface.Impl -// ... -// } -type Impl struct{} - -func (Impl) private() {} diff --git a/protocol/binary/protocol.go b/protocol/binary/protocol.go index 93bf7d64..32d599b7 100644 --- a/protocol/binary/protocol.go +++ b/protocol/binary/protocol.go @@ -26,7 +26,6 @@ import ( "fmt" "io" - "go.uber.org/thriftrw/internal/iface" "go.uber.org/thriftrw/protocol/envelope" "go.uber.org/thriftrw/protocol/stream" "go.uber.org/thriftrw/wire" @@ -36,9 +35,7 @@ import ( var Default = new(Protocol) // Protocol implements the Thrift Binary Protocol. -type Protocol struct { - iface.Private -} +type Protocol struct{} var _ stream.Protocol = (*Protocol)(nil) var _ stream.RequestReader = (*Protocol)(nil) diff --git a/protocol/binary/stream_reader.go b/protocol/binary/stream_reader.go index fe5921a7..cce8c462 100644 --- a/protocol/binary/stream_reader.go +++ b/protocol/binary/stream_reader.go @@ -27,7 +27,6 @@ import ( "math" "sync" - "go.uber.org/thriftrw/internal/iface" "go.uber.org/thriftrw/protocol/stream" "go.uber.org/thriftrw/wire" ) @@ -62,8 +61,6 @@ func fixedWidth(t wire.Type) int64 { // StreamReader provides an implementation of a "stream.Reader". type StreamReader struct { - iface.Private - reader io.Reader buffer [8]byte diff --git a/protocol/binary/stream_writer.go b/protocol/binary/stream_writer.go index 6a96a13c..d4853e53 100644 --- a/protocol/binary/stream_writer.go +++ b/protocol/binary/stream_writer.go @@ -25,7 +25,6 @@ import ( "math" "sync" - "go.uber.org/thriftrw/internal/iface" "go.uber.org/thriftrw/protocol/stream" ) @@ -37,9 +36,6 @@ var streamWriterPool = sync.Pool{ // StreamWriter implements basic logic for writing the Thrift Binary Protocol // to an io.Writer. type StreamWriter struct { - // Private implementation to satisfy the private Writer interface. - iface.Impl - writer io.Writer // This buffer is re-used every time we need a slice of up to 8 bytes. diff --git a/protocol/stream/stream.go b/protocol/stream/stream.go index e6158a8f..8038fe60 100644 --- a/protocol/stream/stream.go +++ b/protocol/stream/stream.go @@ -25,15 +25,12 @@ package stream import ( "io" - "go.uber.org/thriftrw/internal/iface" "go.uber.org/thriftrw/wire" ) // Protocol defines a specific way for a Thrift value to be encoded or // decoded, implemented in a streaming fashion. type Protocol interface { - iface.Private // this interface is meant for internal implementations only - // Writer returns a streaming implementation of an encoder for a // Thrift value. Writer(w io.Writer) Writer @@ -84,8 +81,6 @@ type ListHeader struct { // Writer defines an encoder for a Thrift value, implemented in a streaming // fashion. type Writer interface { - iface.Private // this interface is meant for internal implementations only - WriteBool(b bool) error WriteInt8(i int8) error WriteInt16(i int16) error @@ -114,8 +109,6 @@ type Writer interface { // Reader defines an decoder for a Thrift value, implemented in a streaming // fashion. type Reader interface { - iface.Private // this interface is meant for internal implementations only - ReadBool() (bool, error) ReadInt8() (int8, error) ReadInt16() (int16, error) diff --git a/thrifttest/streamtest/mock_stream.go b/thrifttest/streamtest/mock_stream.go index c0cdbaaf..0e1bd2d3 100644 --- a/thrifttest/streamtest/mock_stream.go +++ b/thrifttest/streamtest/mock_stream.go @@ -84,18 +84,6 @@ func (mr *MockProtocolMockRecorder) Writer(arg0 interface{}) *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Writer", reflect.TypeOf((*MockProtocol)(nil).Writer), arg0) } -// private mocks base method -func (m *MockProtocol) private() { - m.ctrl.T.Helper() - m.ctrl.Call(m, "private") -} - -// private indicates an expected call of private -func (mr *MockProtocolMockRecorder) private() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "private", reflect.TypeOf((*MockProtocol)(nil).private)) -} - // MockWriter is a mock of Writer interface type MockWriter struct { ctrl *gomock.Controller @@ -413,18 +401,6 @@ func (mr *MockWriterMockRecorder) WriteStructEnd() *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WriteStructEnd", reflect.TypeOf((*MockWriter)(nil).WriteStructEnd)) } -// private mocks base method -func (m *MockWriter) private() { - m.ctrl.T.Helper() - m.ctrl.Call(m, "private") -} - -// private indicates an expected call of private -func (mr *MockWriterMockRecorder) private() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "private", reflect.TypeOf((*MockWriter)(nil).private)) -} - // MockReader is a mock of Reader interface type MockReader struct { ctrl *gomock.Controller @@ -770,18 +746,6 @@ func (mr *MockReaderMockRecorder) Skip(arg0 interface{}) *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Skip", reflect.TypeOf((*MockReader)(nil).Skip), arg0) } -// private mocks base method -func (m *MockReader) private() { - m.ctrl.T.Helper() - m.ctrl.Call(m, "private") -} - -// private indicates an expected call of private -func (mr *MockReaderMockRecorder) private() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "private", reflect.TypeOf((*MockReader)(nil).private)) -} - // MockBodyReader is a mock of BodyReader interface type MockBodyReader struct { ctrl *gomock.Controller