From 33c484047516708f4f4d891582e6dfd735d4959c Mon Sep 17 00:00:00 2001
From: "p.merzlyakov"
Date: Mon, 4 Jul 2022 18:11:53 +0300
Subject: [PATCH] workaround for this issue:
https://github.com/golang/go/issues/33437
---
targets/go/go_tpl.inc.php | 24 +++++++++++++++++++-----
1 file changed, 19 insertions(+), 5 deletions(-)
diff --git a/targets/go/go_tpl.inc.php b/targets/go/go_tpl.inc.php
index c84443f..abe6baf 100644
--- a/targets/go/go_tpl.inc.php
+++ b/targets/go/go_tpl.inc.php
@@ -15,9 +15,14 @@ type %class% struct {
%fields%
}
-var _%class%_class_props map[string]string = %class_props%
+var _%class%_class_props map[string]string
var _%class%_class_fields []string = %fields_names%
-var _%class%_fields_props meta.ClassFieldsProps = %fields_props%
+var _%class%_fields_props meta.ClassFieldsProps
+
+func init() {
+ _%class%_class_props = %class_props%
+ _%class%_fields_props = %fields_props%
+}
func %class%_CLASS_ID() uint32 {
return %class_id%
@@ -157,7 +162,11 @@ const (%consts%)
type %class% int32
var _%class%_values []int = []int{%values_list%}
-var _%class%_map map[string]%class% = map[string]%class%{%values_map%}
+var _%class%_map map[string]%class%
+
+func init() {
+ _%class%_map = map[string]%class%{%values_map%}
+}
func (*%class%) CLASS_ID() uint32 {
return %class_id%
@@ -209,11 +218,15 @@ type %class% struct {
%fields%
}
-var _%class%_class_props map[string]string = %class_props%
+var _%class%_class_props map[string]string
var _%class%_class_fields []string = %fields_names%
var %class%_ func(interface{}, *%class%, *%class_invert%) error
var _%class%_fields_props meta.ClassFieldsProps = nil
+func init() {
+ _%class%_class_props = %class_props%
+}
+
type I%class% interface {
meta.IMetaStruct
I%class%() *%class%
@@ -290,8 +303,9 @@ package autogen
import (
"fmt"
"sort"
+
"github.com/bit.games/meta"
- "github.com/bit.games/errors"
+ "github.com/pkg/errors"
)
//supress *imported but not used* warnings