cmd: move internal/str back to cmd/go

cmd/go is not subject to all the same restrictions as most of cmd.
In particular it need not be buildable with the bootstrap toolchain.
So it is better to keep as little code shared between cmd/go and
cmd/compile, cmd/link, cmd/cgo as possible.

cmd/internal/str started as cmd/go/internal/str but was moved
to cmd/internal in order to make use of the quoted string code.
Move that code to cmd/internal/quoted and then move the rest of
cmd/internal/str back to cmd/go/internal/str.

Change-Id: I3a98f754d545cc3af7e9a32c2b77a5a035ea7b9a
Reviewed-on: https://go-review.googlesource.com/c/go/+/355010
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
This commit is contained in:
Russ Cox 2021-10-11 11:57:24 -04:00
parent cfb532158f
commit 4f73fd05a9
35 changed files with 314 additions and 292 deletions

View file

@ -29,7 +29,7 @@ import (
"unicode"
"unicode/utf8"
"cmd/internal/str"
"cmd/internal/quoted"
)
var debugDefine = flag.Bool("debug-define", false, "print relevant #defines")
@ -1568,7 +1568,7 @@ func checkGCCBaseCmd() ([]string, error) {
if value == "" {
value = defaultCC(goos, goarch)
}
args, err := str.SplitQuotedFields(value)
args, err := quoted.Split(value)
if err != nil {
return nil, err
}