From 960d8012762f7140096f8727e0ac9e6e68f72636 Mon Sep 17 00:00:00 2001 From: thsun Date: Wed, 24 Feb 2021 17:18:21 +0800 Subject: [PATCH] canonical code --- go/sql/types.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/go/sql/types.go b/go/sql/types.go index 97db473..1444c8e 100644 --- a/go/sql/types.go +++ b/go/sql/types.go @@ -52,9 +52,10 @@ func (this *Column) convertArg(arg interface{}) interface{} { } if this.Type == BinaryColumnType { - size := len([]byte(arg.(string))) + arg2Bytes := []byte(arg.(string)) + size := len(arg2Bytes) if uint(size) < this.BinaryOctetLength { - buf := bytes.NewBuffer([]byte(arg.(string))) + buf := bytes.NewBuffer(arg2Bytes) for i := uint(0); i < (this.BinaryOctetLength - uint(size)); i++ { buf.Write([]byte{0}) }