[go] cmd/dist: support spaces and quotes in CC

19 views
Skip to first unread message

Gerrit Bot (Gerrit)

unread,
May 19, 2022, 3:09:59 AM5/19/22
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

Gerrit Bot has uploaded this change for review.

View Change

cmd/dist: support spaces and quotes in CC

As of 742dcba7bb953a96c9f3fcdeb32b1c03cbbd8d5e `go build` can accept `$CC` with spaces and quotes, which lets us easily use `zig cc` as the C compiler, or easily pass extra compiler parameters:

```
CC="zig cc" go build <...>
CC="clang-13 -v" go build <...>
CC="zig cc -Wl,--print-gc-sections" go build <...>
```

However, the same does not apply for building go itself:

```
$ CC="zig cc" ./make.bash
Building Go cmd/dist using /usr/local/go. (go1.18.2 linux/amd64)
go tool dist: cannot invoke C compiler "zig cc": exec: "zig cc": executable file not found in $PATH

Go needs a system C compiler for use with cgo.
To set a C compiler, set CC=the-compiler.
To disable cgo, set CGO_ENABLED=0.
```

With this change Go can be built directly with `zig cc` (the linker arg will disappear with #52815 and/or #52690):

```
$ CC="zig cc -Wl,--no-gc-sections" ./make.bash
Building Go cmd/dist using /usr/local/go. (go1.18.2 linux/amd64)
Building Go toolchain1 using /usr/local/go.
Building Go bootstrap cmd/go (go_bootstrap) using Go toolchain1.
Building Go toolchain2 using go_bootstrap and Go toolchain1.
Building Go toolchain3 using go_bootstrap and Go toolchain2.
Building packages and commands for linux/amd64.
---
Installed Go for linux/amd64 in /home/motiejus/code/go
Installed commands in /home/motiejus/code/go/bin
$ ../bin/go version
go version devel go1.19-811f1913a8 Thu May 19 09:44:49 2022 +0300 linux/amd64
```

Fixes #52990

Change-Id: I66b3525d47db488d3c583c1aee3af78060fd5a38
GitHub-Last-Rev: f60bf32bbdbc4158bda92c32188bff50c4f09cc6
GitHub-Pull-Request: golang/go#52991
---
M src/cmd/dist/build.go
A src/cmd/dist/quoted.go
M src/cmd/internal/quoted/quoted.go
3 files changed, 109 insertions(+), 2 deletions(-)

diff --git a/src/cmd/dist/build.go b/src/cmd/dist/build.go
index f99f1f4..e7ba8a0 100644
--- a/src/cmd/dist/build.go
+++ b/src/cmd/dist/build.go
@@ -1631,7 +1631,13 @@
if !needCC() {
return
}
- if output, err := exec.Command(defaultcc[""], "--help").CombinedOutput(); err != nil {
+ cc, err := quotedSplit(defaultcc[""])
+ if err != nil {
+ fatalf("split CC: %v", err)
+ }
+ var ccHelp = append(cc, "--help")
+
+ if output, err := exec.Command(ccHelp[0], ccHelp[1:]...).CombinedOutput(); err != nil {
outputHdr := ""
if len(output) > 0 {
outputHdr = "\nCommand output:\n\n"
@@ -1639,7 +1645,7 @@
fatalf("cannot invoke C compiler %q: %v\n\n"+
"Go needs a system C compiler for use with cgo.\n"+
"To set a C compiler, set CC=the-compiler.\n"+
- "To disable cgo, set CGO_ENABLED=0.\n%s%s", defaultcc[""], err, outputHdr, output)
+ "To disable cgo, set CGO_ENABLED=0.\n%s%s", cc, err, outputHdr, output)
}
}

diff --git a/src/cmd/dist/quoted.go b/src/cmd/dist/quoted.go
new file mode 100644
index 0000000..e87b8a3
--- /dev/null
+++ b/src/cmd/dist/quoted.go
@@ -0,0 +1,49 @@
+package main
+
+import "fmt"
+
+// quotedSplit is a verbatim copy from cmd/internal/quoted.go:Split and its
+// dependencies (isSpaceByte). Since this package is built using the host's
+// Go compiler, it cannot use `cmd/internal/...`. We also don't want to export
+// it to all Go users.
+//
+// Please keep those in sync.
+func quotedSplit(s string) ([]string, error) {
+ // Split fields allowing '' or "" around elements.
+ // Quotes further inside the string do not count.
+ var f []string
+ for len(s) > 0 {
+ for len(s) > 0 && isSpaceByte(s[0]) {
+ s = s[1:]
+ }
+ if len(s) == 0 {
+ break
+ }
+ // Accepted quoted string. No unescaping inside.
+ if s[0] == '"' || s[0] == '\'' {
+ quote := s[0]
+ s = s[1:]
+ i := 0
+ for i < len(s) && s[i] != quote {
+ i++
+ }
+ if i >= len(s) {
+ return nil, fmt.Errorf("unterminated %c string", quote)
+ }
+ f = append(f, s[:i])
+ s = s[i+1:]
+ continue
+ }
+ i := 0
+ for i < len(s) && !isSpaceByte(s[i]) {
+ i++
+ }
+ f = append(f, s[:i])
+ s = s[i:]
+ }
+ return f, nil
+}
+
+func isSpaceByte(c byte) bool {
+ return c == ' ' || c == '\t' || c == '\n' || c == '\r'
+}
diff --git a/src/cmd/internal/quoted/quoted.go b/src/cmd/internal/quoted/quoted.go
index e7575df..b3d3c40 100644
--- a/src/cmd/internal/quoted/quoted.go
+++ b/src/cmd/internal/quoted/quoted.go
@@ -20,6 +20,8 @@
// allowing single or double quotes around elements.
// There is no unescaping or other processing within
// quoted fields.
+//
+// Keep in sync with cmd/dist/quoted.go
func Split(s string) ([]string, error) {
// Split fields allowing '' or "" around elements.
// Quotes further inside the string do not count.

To view, visit change 407216. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I66b3525d47db488d3c583c1aee3af78060fd5a38
Gerrit-Change-Number: 407216
Gerrit-PatchSet: 1
Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
Gerrit-MessageType: newchange

Motiejus Jakštys (Gerrit)

unread,
May 19, 2022, 3:26:12 AM5/19/22
to Gerrit Bot, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

View Change

1 comment:

  • Patchset:

    • Patch Set #1:

      + Jay Conrod, author of the commit that made CC-with-spaces possible in the first place.

To view, visit change 407216. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I66b3525d47db488d3c583c1aee3af78060fd5a38
Gerrit-Change-Number: 407216
Gerrit-PatchSet: 1
Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
Gerrit-CC: Motiejus Jakštys <desir...@gmail.com>
Gerrit-Comment-Date: Thu, 19 May 2022 07:26:06 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment

Ian Lance Taylor (Gerrit)

unread,
May 19, 2022, 6:56:58 PM5/19/22
to Gerrit Bot, goph...@pubsubhelper.golang.org, Ian Lance Taylor, Austin Clements, Russ Cox, Motiejus Jakštys, golang-co...@googlegroups.com

Attention is currently required from: Austin Clements, Russ Cox.

Patch set 1:Run-TryBot +1

View Change

1 comment:

  • Commit Message:

    • Patch Set #1, Line 9: As of 742dcba7bb953a96c9f3fcdeb32b1c03cbbd8d5e `go build` can accept `$CC` with spaces and quotes, which lets us easily use `zig cc` as the C compiler, or easily pass extra compiler parameters:

      Instead of he git revision please write "CL 334732". Please also break this long line around 76 characters or so. Thanks.

To view, visit change 407216. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I66b3525d47db488d3c583c1aee3af78060fd5a38
Gerrit-Change-Number: 407216
Gerrit-PatchSet: 1
Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
Gerrit-Reviewer: Austin Clements <aus...@google.com>
Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
Gerrit-Reviewer: Russ Cox <r...@golang.org>
Gerrit-CC: Michael Knyszek <mkny...@google.com>
Gerrit-CC: Motiejus Jakštys <desir...@gmail.com>
Gerrit-Attention: Austin Clements <aus...@google.com>
Gerrit-Attention: Russ Cox <r...@golang.org>
Gerrit-Comment-Date: Thu, 19 May 2022 22:56:54 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

Ian Lance Taylor (Gerrit)

unread,
May 19, 2022, 7:11:36 PM5/19/22
to Gerrit Bot, goph...@pubsubhelper.golang.org, Gopher Robot, Ian Lance Taylor, Austin Clements, Russ Cox, Motiejus Jakštys, golang-co...@googlegroups.com

Attention is currently required from: Austin Clements, Russ Cox.

Patch set 1:Run-TryBot +1Auto-Submit +1Code-Review +2

View Change

1 comment:

To view, visit change 407216. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I66b3525d47db488d3c583c1aee3af78060fd5a38
Gerrit-Change-Number: 407216
Gerrit-PatchSet: 1
Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
Gerrit-Reviewer: Austin Clements <aus...@google.com>
Gerrit-Reviewer: Gopher Robot <go...@golang.org>
Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
Gerrit-Reviewer: Ian Lance Taylor <ia...@google.com>
Gerrit-Reviewer: Russ Cox <r...@golang.org>
Gerrit-CC: Michael Knyszek <mkny...@google.com>
Gerrit-CC: Motiejus Jakštys <desir...@gmail.com>
Gerrit-Attention: Austin Clements <aus...@google.com>
Gerrit-Attention: Russ Cox <r...@golang.org>
Gerrit-Comment-Date: Thu, 19 May 2022 23:11:32 +0000

Motiejus Jakštys (Gerrit)

unread,
May 20, 2022, 3:28:09 AM5/20/22
to Gerrit Bot, goph...@pubsubhelper.golang.org, Gopher Robot, Ian Lance Taylor, Austin Clements, Russ Cox, golang-co...@googlegroups.com

Attention is currently required from: Austin Clements, Ian Lance Taylor, Russ Cox.

View Change

1 comment:

  • Commit Message:

    • Patch Set #1, Line 9: As of 742dcba7bb953a96c9f3fcdeb32b1c03cbbd8d5e `go build` can accept `$CC` with spaces and quotes, which lets us easily use `zig cc` as the C compiler, or easily pass extra compiler parameters:

    • Instead of he git revision please write "CL 334732". […]

      Done

To view, visit change 407216. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I66b3525d47db488d3c583c1aee3af78060fd5a38
Gerrit-Change-Number: 407216
Gerrit-PatchSet: 1
Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
Gerrit-Reviewer: Austin Clements <aus...@google.com>
Gerrit-Reviewer: Gopher Robot <go...@golang.org>
Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
Gerrit-Reviewer: Ian Lance Taylor <ia...@google.com>
Gerrit-Reviewer: Russ Cox <r...@golang.org>
Gerrit-CC: Michael Knyszek <mkny...@google.com>
Gerrit-CC: Motiejus Jakštys <desir...@gmail.com>
Gerrit-Attention: Austin Clements <aus...@google.com>
Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
Gerrit-Attention: Russ Cox <r...@golang.org>
Gerrit-Comment-Date: Fri, 20 May 2022 07:28:04 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Ian Lance Taylor <ia...@golang.org>
Gerrit-MessageType: comment

Gerrit Bot (Gerrit)

unread,
May 20, 2022, 3:28:45 AM5/20/22
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

Attention is currently required from: Austin Clements, Ian Lance Taylor, Ian Lance Taylor, Russ Cox.

Gerrit Bot uploaded patch set #2 to this change.

View Change

The following approvals got outdated and were removed: Auto-Submit+1 by Ian Lance Taylor, Run-TryBot+1 by Ian Lance Taylor, Run-TryBot+1 by Ian Lance Taylor, TryBot-Result+1 by Gopher Robot

cmd/dist: support spaces and quotes in CC

cmd/dist: support spaces and quotes in CC

As of CL 334732 `go build` can accept `$CC` with spaces and quotes,

which lets us easily use `zig cc` as the C compiler, or easily pass
extra compiler parameters:

GitHub-Last-Rev: 39d51c4a6b2bdf64f08c7a5575fa268094f0ab07

GitHub-Pull-Request: golang/go#52991
---
M src/cmd/dist/build.go
A src/cmd/dist/quoted.go
M src/cmd/internal/quoted/quoted.go
3 files changed, 114 insertions(+), 2 deletions(-)

To view, visit change 407216. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I66b3525d47db488d3c583c1aee3af78060fd5a38
Gerrit-Change-Number: 407216
Gerrit-PatchSet: 2
Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
Gerrit-Reviewer: Austin Clements <aus...@google.com>
Gerrit-Reviewer: Gopher Robot <go...@golang.org>
Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
Gerrit-Reviewer: Ian Lance Taylor <ia...@google.com>
Gerrit-Reviewer: Russ Cox <r...@golang.org>
Gerrit-CC: Michael Knyszek <mkny...@google.com>
Gerrit-CC: Motiejus Jakštys <desir...@gmail.com>
Gerrit-Attention: Ian Lance Taylor <ia...@google.com>
Gerrit-Attention: Austin Clements <aus...@google.com>
Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
Gerrit-Attention: Russ Cox <r...@golang.org>
Gerrit-MessageType: newpatchset

Gerrit Bot (Gerrit)

unread,
May 20, 2022, 3:32:53 AM5/20/22
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

Attention is currently required from: Austin Clements, Ian Lance Taylor, Ian Lance Taylor, Russ Cox.

Gerrit Bot uploaded patch set #3 to this change.

View Change

cmd/dist: support spaces and quotes in CC


As of CL 334732 `go build` can accept `$CC` with spaces and quotes,
which lets us easily use `zig cc` as the C compiler, or easily pass
extra compiler parameters:

```
CC="zig cc" go build <...>
CC="clang-13 -v" go build <...>
CC="zig cc -Wl,--print-gc-sections" go build <...>
```

However, the same does not apply for building go itself:

```
$ CC="zig cc" ./make.bash
Building Go cmd/dist using /usr/local/go. (go1.18.2 linux/amd64)
go tool dist: cannot invoke C compiler "zig cc": exec: "zig cc": executable file not found in $PATH

Go needs a system C compiler for use with cgo.
To set a C compiler, set CC=the-compiler.
To disable cgo, set CGO_ENABLED=0.
```

With this change Go can be built directly with `zig cc` (the linker arg
will disappear with CL 405414):


```
$ CC="zig cc -Wl,--no-gc-sections" ./make.bash
Building Go cmd/dist using /usr/local/go. (go1.18.2 linux/amd64)
Building Go toolchain1 using /usr/local/go.
Building Go bootstrap cmd/go (go_bootstrap) using Go toolchain1.
Building Go toolchain2 using go_bootstrap and Go toolchain1.
Building Go toolchain3 using go_bootstrap and Go toolchain2.
Building packages and commands for linux/amd64.
---
Installed Go for linux/amd64 in /home/motiejus/code/go
Installed commands in /home/motiejus/code/go/bin
$ ../bin/go version
go version devel go1.19-811f1913a8 Thu May 19 09:44:49 2022 +0300 linux/amd64
```

Fixes #52990

Change-Id: I66b3525d47db488d3c583c1aee3af78060fd5a38
GitHub-Last-Rev: ecc70d722406f0c7d0c1930c872db392e80e7cf5

GitHub-Pull-Request: golang/go#52991
---
M src/cmd/dist/build.go
A src/cmd/dist/quoted.go
M src/cmd/internal/quoted/quoted.go
3 files changed, 112 insertions(+), 2 deletions(-)

To view, visit change 407216. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I66b3525d47db488d3c583c1aee3af78060fd5a38
Gerrit-Change-Number: 407216
Gerrit-PatchSet: 3

Ian Lance Taylor (Gerrit)

unread,
May 20, 2022, 1:54:54 PM5/20/22
to Gerrit Bot, goph...@pubsubhelper.golang.org, Gopher Robot, Ian Lance Taylor, Austin Clements, Russ Cox, Motiejus Jakštys, golang-co...@googlegroups.com

Attention is currently required from: Austin Clements, Ian Lance Taylor, Russ Cox.

Patch set 3:Run-TryBot +1Auto-Submit +1Code-Review +2

View Change

    To view, visit change 407216. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I66b3525d47db488d3c583c1aee3af78060fd5a38
    Gerrit-Change-Number: 407216
    Gerrit-PatchSet: 3
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Austin Clements <aus...@google.com>
    Gerrit-Reviewer: Gopher Robot <go...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@google.com>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-CC: Michael Knyszek <mkny...@google.com>
    Gerrit-CC: Motiejus Jakštys <desir...@gmail.com>
    Gerrit-Attention: Austin Clements <aus...@google.com>
    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-Comment-Date: Fri, 20 May 2022 17:54:50 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: Yes
    Gerrit-MessageType: comment

    Ian Lance Taylor (Gerrit)

    unread,
    May 20, 2022, 5:00:39 PM5/20/22
    to Gerrit Bot, goph...@pubsubhelper.golang.org, Gopher Robot, Ian Lance Taylor, Austin Clements, Russ Cox, Motiejus Jakštys, golang-co...@googlegroups.com

    Attention is currently required from: Austin Clements, Russ Cox.

    View Change

    1 comment:

    • Patchset:

    To view, visit change 407216. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I66b3525d47db488d3c583c1aee3af78060fd5a38
    Gerrit-Change-Number: 407216
    Gerrit-PatchSet: 3
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Austin Clements <aus...@google.com>
    Gerrit-Reviewer: Gopher Robot <go...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@google.com>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-CC: Michael Knyszek <mkny...@google.com>
    Gerrit-CC: Motiejus Jakštys <desir...@gmail.com>
    Gerrit-Attention: Austin Clements <aus...@google.com>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-Comment-Date: Fri, 20 May 2022 21:00:35 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Gerrit-MessageType: comment

    Ian Lance Taylor (Gerrit)

    unread,
    May 20, 2022, 5:01:01 PM5/20/22
    to Gerrit Bot, Ian Lance Taylor, goph...@pubsubhelper.golang.org, Gopher Robot, Austin Clements, Russ Cox, Motiejus Jakštys, golang-co...@googlegroups.com

    Attention is currently required from: Austin Clements, Ian Lance Taylor, Russ Cox.

    Patch set 4:Run-TryBot +1Auto-Submit +1Code-Review +2

    View Change

      To view, visit change 407216. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: I66b3525d47db488d3c583c1aee3af78060fd5a38
      Gerrit-Change-Number: 407216
      Gerrit-PatchSet: 4
      Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
      Gerrit-Reviewer: Austin Clements <aus...@google.com>
      Gerrit-Reviewer: Gopher Robot <go...@golang.org>
      Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
      Gerrit-Reviewer: Ian Lance Taylor <ia...@google.com>
      Gerrit-Reviewer: Russ Cox <r...@golang.org>
      Gerrit-CC: Michael Knyszek <mkny...@google.com>
      Gerrit-CC: Motiejus Jakštys <desir...@gmail.com>
      Gerrit-Attention: Austin Clements <aus...@google.com>
      Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
      Gerrit-Attention: Russ Cox <r...@golang.org>
      Gerrit-Comment-Date: Fri, 20 May 2022 21:00:57 +0000

      Alex Rakoczy (Gerrit)

      unread,
      May 26, 2022, 4:13:58 PM5/26/22
      to Gerrit Bot, Ian Lance Taylor, goph...@pubsubhelper.golang.org, Gopher Robot, Austin Clements, Russ Cox, Motiejus Jakštys, golang-co...@googlegroups.com

      Attention is currently required from: Austin Clements, Ian Lance Taylor, Russ Cox.

      Patch set 4:Code-Review +1

      View Change

        To view, visit change 407216. To unsubscribe, or for help writing mail filters, visit settings.

        Gerrit-Project: go
        Gerrit-Branch: master
        Gerrit-Change-Id: I66b3525d47db488d3c583c1aee3af78060fd5a38
        Gerrit-Change-Number: 407216
        Gerrit-PatchSet: 4
        Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
        Gerrit-Reviewer: Alex Rakoczy <al...@golang.org>
        Gerrit-Reviewer: Austin Clements <aus...@google.com>
        Gerrit-Reviewer: Gopher Robot <go...@golang.org>
        Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Reviewer: Ian Lance Taylor <ia...@google.com>
        Gerrit-Reviewer: Russ Cox <r...@golang.org>
        Gerrit-CC: Michael Knyszek <mkny...@google.com>
        Gerrit-CC: Motiejus Jakštys <desir...@gmail.com>
        Gerrit-Attention: Austin Clements <aus...@google.com>
        Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Attention: Russ Cox <r...@golang.org>
        Gerrit-Comment-Date: Thu, 26 May 2022 20:13:54 +0000

        Gopher Robot (Gerrit)

        unread,
        May 26, 2022, 4:14:20 PM5/26/22
        to Gerrit Bot, goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Alex Rakoczy, Ian Lance Taylor, Austin Clements, Russ Cox, Michael Knyszek, Motiejus Jakštys, golang-co...@googlegroups.com

        Gopher Robot submitted this change.

        View Change


        Approvals: Ian Lance Taylor: Looks good to me, approved; Run TryBots; Automatically submit change Alex Rakoczy: Looks good to me, but someone else must approve Gopher Robot: TryBots succeeded
        Reviewed-on: https://go-review.googlesource.com/c/go/+/407216
        Reviewed-by: Ian Lance Taylor <ia...@google.com>
        Run-TryBot: Ian Lance Taylor <ia...@google.com>
        Auto-Submit: Ian Lance Taylor <ia...@google.com>
        Reviewed-by: Alex Rakoczy <al...@golang.org>
        TryBot-Result: Gopher Robot <go...@golang.org>

        ---
        M src/cmd/dist/build.go
        A src/cmd/dist/quoted.go
        M src/cmd/internal/quoted/quoted.go
        3 files changed, 118 insertions(+), 2 deletions(-)

        diff --git a/src/cmd/dist/build.go b/src/cmd/dist/build.go
        index 0a7af2b..7c44c4a 100644
        --- a/src/cmd/dist/build.go
        +++ b/src/cmd/dist/build.go
        @@ -1630,7 +1630,13 @@

        if !needCC() {
        return
        }
        - if output, err := exec.Command(defaultcc[""], "--help").CombinedOutput(); err != nil {
        + cc, err := quotedSplit(defaultcc[""])
        + if err != nil {
        + fatalf("split CC: %v", err)
        + }
        + var ccHelp = append(cc, "--help")
        +
        + if output, err := exec.Command(ccHelp[0], ccHelp[1:]...).CombinedOutput(); err != nil {
        outputHdr := ""
        if len(output) > 0 {
        outputHdr = "\nCommand output:\n\n"
        @@ -1638,7 +1644,7 @@

        To view, visit change 407216. To unsubscribe, or for help writing mail filters, visit settings.

        Gerrit-Project: go
        Gerrit-Branch: master
        Gerrit-Change-Id: I66b3525d47db488d3c583c1aee3af78060fd5a38
        Gerrit-Change-Number: 407216
        Gerrit-PatchSet: 5
        Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
        Gerrit-Reviewer: Alex Rakoczy <al...@golang.org>
        Gerrit-Reviewer: Austin Clements <aus...@google.com>
        Gerrit-Reviewer: Gopher Robot <go...@golang.org>
        Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Reviewer: Ian Lance Taylor <ia...@google.com>
        Gerrit-Reviewer: Russ Cox <r...@golang.org>
        Gerrit-CC: Michael Knyszek <mkny...@google.com>
        Gerrit-CC: Motiejus Jakštys <desir...@gmail.com>
        Gerrit-MessageType: merged
        Reply all
        Reply to author
        Forward
        0 new messages