appendSetting("-ldflags", ldflags)
}
}
- // N.B. -pgo added later by setPGOProfilePath.
if cfg.BuildMSan {
appendSetting("-msan", "true")
}
+ // N.B. -pgo added later by setPGOProfilePath.
if cfg.BuildRace {
appendSetting("-race", "true")
}
} else {
appendBuildSetting(p.Internal.BuildInfo, "-pgo", file)
}
+ // Adding -pgo breaks the sort order in BuildInfo.Settings. Restore it.
+ slices.SortFunc(p.Internal.BuildInfo.Settings, func(x, y debug.BuildSetting) int {
+ return strings.Compare(x.Key, y.Key)
+ })
}
switch cfg.BuildPGO {
# if the first arg starts with - it is a grep flag.
stderr 'build\\t-pgo=.*default\.pgo'
+# check also that -pgo appears with the other flags, before non-flag settings
+! stderr 'build\\t[A-Za-z].*build\\t-pgo'
+
# use default.pgo for ... with a single main package
go build -n -pgo=auto ./a/...
stderr 'compile.*-pgoprofile=.*default\.pgo.*a1.go'