From: Ingo Oeser Date: Sun, 15 Apr 2018 11:46:18 +0000 (+0200) Subject: cmd/compile: fix double go prefix trim X-Git-Tag: go1.11beta1~821 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=b47806d1b57bd871b30fe5980454537eaefce27c;p=gostls13.git cmd/compile: fix double go prefix trim CL 106463 introduced what seems to trim the "go:" prefix in pramas comments twice, so "//go:go:foo" would be handled, too. So either the strings.TrimPrefix or the [3:]-slicing is not needed. I opted to remove the [3:]-slicing. Change-Id: I1325bbc08a9be9ae100c5a7775b0a23f9ed0a419 Reviewed-on: https://go-review.googlesource.com/107256 Reviewed-by: Matthew Dempsky Run-TryBot: Matthew Dempsky TryBot-Result: Gobot Gobot --- diff --git a/src/cmd/compile/internal/gc/lex.go b/src/cmd/compile/internal/gc/lex.go index 1c2cc9518d..3b302a5124 100644 --- a/src/cmd/compile/internal/gc/lex.go +++ b/src/cmd/compile/internal/gc/lex.go @@ -96,7 +96,7 @@ func pragmaValue(verb string) syntax.Pragma { func (p *noder) pragcgo(pos syntax.Pos, text string) { f := pragmaFields(text) - verb := strings.TrimPrefix(f[0][3:], "go:") + verb := strings.TrimPrefix(f[0], "go:") f[0] = verb switch verb {