cmd/dlv: use -a flag with go1.9
By specifying the -a flag we insure that all packages are recompiled with -gcflags='-N -l'. Previously -a could not be specified because the compiler could not compile runtime without optimizations. Fixes #738
This commit is contained in:
parent
2ad9ce6fe3
commit
ec8e6c4af3
@ -536,6 +536,10 @@ func gobuild(debugname, pkg string) error {
|
|||||||
if BuildFlags != "" {
|
if BuildFlags != "" {
|
||||||
args = append(args, splitQuotedFields(BuildFlags)...)
|
args = append(args, splitQuotedFields(BuildFlags)...)
|
||||||
}
|
}
|
||||||
|
if ver, _ := goversion.Installed(); ver.Major < 0 || ver.AfterOrEqual(goversion.GoVersion{1, 9, -1, 0, 0, ""}) {
|
||||||
|
// after go1.9 building with -gcflags='-N -l' and -a simultaneously works
|
||||||
|
args = append(args, "-a")
|
||||||
|
}
|
||||||
args = append(args, pkg)
|
args = append(args, pkg)
|
||||||
return gocommand("build", args...)
|
return gocommand("build", args...)
|
||||||
}
|
}
|
||||||
@ -545,6 +549,10 @@ func gotestbuild(pkg string) error {
|
|||||||
if BuildFlags != "" {
|
if BuildFlags != "" {
|
||||||
args = append(args, splitQuotedFields(BuildFlags)...)
|
args = append(args, splitQuotedFields(BuildFlags)...)
|
||||||
}
|
}
|
||||||
|
if ver, _ := goversion.Installed(); ver.Major < 0 || ver.AfterOrEqual(goversion.GoVersion{1, 9, -1, 0, 0, ""}) {
|
||||||
|
// after go1.9 building with -gcflags='-N -l' and -a simultaneously works
|
||||||
|
args = append(args, "-a")
|
||||||
|
}
|
||||||
args = append(args, pkg)
|
args = append(args, pkg)
|
||||||
return gocommand("test", args...)
|
return gocommand("test", args...)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user