-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Description
Describe the bug
A clear and concise description of what the bug is.
I configured the mysql conf in the yaml file, but I introduced the slave in its structure An optional tag was added to distinguish the master from the slave. When loading the yaml configuration file, when reflecting and parsing the configuration of mysql and attempting to parse the structure of mysql, it would always enter the parsing of the slave. The optional did not work and fell into an infinite loop, resulting in a memory leak
To Reproduce
Steps to reproduce the behavior, if applicable:
-
The code is
type GlobalConfig struct {
CN CountryConfig
}
type CountryConfig struct {
MySQL MySQLConfig json:",optional"
}
type MySQLConfig struct {
Alias string json:",optional"
DSN string json:",optional"
Type string json:",optional"
// master or slave
MaxOpenConns int json:",optional"
MaxIdleConns int json:",optional"
ConnMaxIdleTime time.Duration json:",optional"
ConnMaxLifetime time.Duration json:",optional"
LogMode logger.LogLevel json:",optional"
SlowThreshold time.Duration json:",optional"
Slave []*MySQLConfig json:",optional"
}
2. The error is
no error, but mem leak
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Environments (please complete the following information):**
- OS: [mac os]
- go-zero version [1.9.0]
**More description**
Add any other context about the problem here.