diff --git a/internal/unsafe2/unsafe.go b/internal/hack/hack.go similarity index 98% rename from internal/unsafe2/unsafe.go rename to internal/hack/hack.go index c356d3e..c219209 100644 --- a/internal/unsafe2/unsafe.go +++ b/internal/hack/hack.go @@ -14,7 +14,7 @@ * limitations under the License. */ -package unsafe2 +package hack import "unsafe" diff --git a/internal/unsafe2/unsafe_test.go b/internal/hack/hack_test.go similarity index 98% rename from internal/unsafe2/unsafe_test.go rename to internal/hack/hack_test.go index 0b33a89..749dd2f 100644 --- a/internal/unsafe2/unsafe_test.go +++ b/internal/hack/hack_test.go @@ -14,7 +14,7 @@ * limitations under the License. */ -package unsafe2 +package hack import ( "testing" diff --git a/protocol/thrift/binary.go b/protocol/thrift/binary.go index 7c276fb..b4648ab 100644 --- a/protocol/thrift/binary.go +++ b/protocol/thrift/binary.go @@ -22,7 +22,7 @@ import ( "math" "unsafe" - "github.com/cloudwego/gopkg/internal/unsafe2" + "github.com/cloudwego/gopkg/internal/hack" ) var Binary BinaryProtocol @@ -121,7 +121,7 @@ func (BinaryProtocol) WriteString(buf []byte, v string) int { } func (p BinaryProtocol) WriteStringNocopy(buf []byte, w NocopyWriter, v string) int { - return p.WriteBinaryNocopy(buf, w, unsafe2.StringToByteSlice(v)) + return p.WriteBinaryNocopy(buf, w, hack.StringToByteSlice(v)) } // Append methods