From e0dacd2795ebc4179e0b34250b170bb706c9ee5e Mon Sep 17 00:00:00 2001 From: Owen Diehl Date: Thu, 14 May 2020 17:11:48 -0400 Subject: [PATCH] removes yolostring (#2078) --- pkg/logproto/types.go | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/pkg/logproto/types.go b/pkg/logproto/types.go index e3759c28e7f4..20c5a0a591d1 100644 --- a/pkg/logproto/types.go +++ b/pkg/logproto/types.go @@ -4,7 +4,6 @@ import ( fmt "fmt" io "io" time "time" - "unsafe" ) // Stream contains a unique labels set as a string and a set of entries for it. @@ -148,7 +147,7 @@ func (m *Stream) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Labels = yoloString(dAtA[iNdEx:postIndex]) + m.Labels = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { @@ -301,7 +300,7 @@ func (m *Entry) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Line = yoloString(dAtA[iNdEx:postIndex]) + m.Line = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -421,7 +420,3 @@ func (m *Entry) Equal(that interface{}) bool { } return true } - -func yoloString(buf []byte) string { - return *((*string)(unsafe.Pointer(&buf))) -}