Commit 6cc34386 authored by Maciej Lisiewski's avatar Maciej Lisiewski

One allocation is enough

parent 56664cb6
......@@ -71,9 +71,9 @@ func (conn *Conn) do(args []interface{}) (interface{}, error) {
defer sess.Close()
fn := reflect.ValueOf(sess.Do)
reflectArgs := []reflect.Value{}
for _, arg := range args {
reflectArgs = append(reflectArgs, reflect.ValueOf(arg))
reflectArgs := make([]reflect.Value, len(args))
for i, arg := range args {
reflectArgs[i] = reflect.ValueOf(arg)
}
ret := fn.Call(reflectArgs)
if len(ret) != 2 {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment