VersionSupportsPprof checks if the given version supports pprof endpoints.
(version string)
| 1149 | |
| 1150 | // VersionSupportsPprof checks if the given version supports pprof endpoints. |
| 1151 | func VersionSupportsPprof(version string) bool { |
| 1152 | if version == "" { |
| 1153 | return false |
| 1154 | } |
| 1155 | if version[0] != 'v' { |
| 1156 | version = "v" + version |
| 1157 | } |
| 1158 | // For prerelease versions like "v2.28.0-devel+abc123", we compare |
| 1159 | // the major.minor.patch portion since prereleases of 2.28.0 should |
| 1160 | // have the pprof feature. |
| 1161 | canonical := semver.Canonical(version) |
| 1162 | if idx := strings.Index(canonical, "-"); idx != -1 { |
| 1163 | canonical = canonical[:idx] |
| 1164 | } |
| 1165 | return semver.Compare(canonical, minPprofVersion) >= 0 |
| 1166 | } |
| 1167 | |
| 1168 | func collectPprof(ctx context.Context, d *Deps, b *Bundle) Pprof { |
| 1169 | var pprof Pprof |