cmd/dlv: do not pass "linkmode internal" for windows on go1.9 and later

go1.9 no longer needs "linkmode internal" on windows.

Fixes #755
Fixes #477
Fixes #631
This commit is contained in:
aarzilli
2017-05-04 12:22:08 +02:00
committed by Derek Parker
parent a17de32c23
commit 1128c26b87
8 changed files with 117 additions and 68 deletions

View File

@ -15,6 +15,7 @@ import (
"unicode"
"github.com/derekparker/delve/pkg/config"
"github.com/derekparker/delve/pkg/goversion"
"github.com/derekparker/delve/pkg/terminal"
"github.com/derekparker/delve/pkg/version"
"github.com/derekparker/delve/service"
@ -76,8 +77,11 @@ func New(docCall bool) *cobra.Command {
conf = config.LoadConfig()
buildFlagsDefault := ""
if runtime.GOOS == "windows" {
// Work-around for https://github.com/golang/go/issues/13154
buildFlagsDefault = "-ldflags='-linkmode internal'"
ver, _ := goversion.Installed()
if ver.Major > 0 && !ver.AfterOrEqual(goversion.GoVersion{1, 9, -1, 0, 0, ""}) {
// Work-around for https://github.com/golang/go/issues/13154
buildFlagsDefault = "-ldflags='-linkmode internal'"
}
}
// Main dlv root command.