| 517 | } |
| 518 | |
| 519 | func appendParameters(args []string, tags []string, pkgs ...string) []string { |
| 520 | if pkgdir != "" { |
| 521 | args = append(args, "-pkgdir", pkgdir) |
| 522 | } |
| 523 | if len(tags) > 0 { |
| 524 | args = append(args, "-tags", strings.Join(tags, " ")) |
| 525 | } |
| 526 | if installSuffix != "" { |
| 527 | args = append(args, "-installsuffix", installSuffix) |
| 528 | } |
| 529 | if race { |
| 530 | args = append(args, "-race") |
| 531 | } |
| 532 | |
| 533 | if !debugBinary { |
| 534 | // Regular binaries get version tagged and skip some debug symbols |
| 535 | args = append(args, "-trimpath", "-ldflags", ldflags(tags)) |
| 536 | } else { |
| 537 | // -gcflags to disable optimizations and inlining. Skip -ldflags |
| 538 | // because `Could not launch program: decoding dwarf section info at |
| 539 | // offset 0x0: too short` on 'dlv exec ...' see |
| 540 | // https://github.com/go-delve/delve/issues/79 |
| 541 | args = append(args, "-gcflags", "all=-N -l") |
| 542 | } |
| 543 | |
| 544 | return append(args, pkgs...) |
| 545 | } |
| 546 | |
| 547 | func buildTar(target target, tags []string) { |
| 548 | name := archiveName(target) |