goversion_makemap_gte_go19.go 358 B

123456789101112131415
  1. // Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved.
  2. // Use of this source code is governed by a MIT license found in the LICENSE file.
  3. // +build go1.9
  4. package codec
  5. import "reflect"
  6. func makeMapReflect(t reflect.Type, size int) reflect.Value {
  7. if size < 0 {
  8. return reflect.MakeMapWithSize(t, 4)
  9. }
  10. return reflect.MakeMapWithSize(t, size)
  11. }