SetGCPercentIfNotSet sets the GC target percentage, unless GOGC environment variable is set, in which case SetGCPercentIfNotSet doesn't not override it and let it as is.
(percent int)
| 9 | // variable is set, in which case SetGCPercentIfNotSet doesn't not override it |
| 10 | // and let it as is. |
| 11 | func SetGCPercentIfNotSet(percent int) { |
| 12 | gogc := os.Getenv("GOGC") |
| 13 | if gogc != "" { |
| 14 | return |
| 15 | } |
| 16 | |
| 17 | debug.SetGCPercent(percent) |
| 18 | } |