fix issue in New when creating concurrent-safety var for package gvar (#2573)

This commit is contained in:
刘志铭
2023-04-12 17:38:06 +08:00
committed by GitHub
parent 53afbd0f05
commit 50b5cd50bc

View File

@ -28,7 +28,7 @@ type Var struct {
// The optional parameter `safe` specifies whether Var is used in concurrent-safety,
// which is false in default.
func New(value interface{}, safe ...bool) *Var {
if len(safe) > 0 && !safe[0] {
if len(safe) > 0 && safe[0] {
return &Var{
value: gtype.NewInterface(value),
safe: true,