]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: fix double go prefix trim
authorIngo Oeser <nightlyone@googlemail.com>
Sun, 15 Apr 2018 11:46:18 +0000 (13:46 +0200)
committerMatthew Dempsky <mdempsky@google.com>
Sun, 15 Apr 2018 19:22:11 +0000 (19:22 +0000)
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 <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/cmd/compile/internal/gc/lex.go

index 1c2cc9518d20ffe5e95f7d2f575588e48fea800e..3b302a5124bd096f1ab43ff9dadf404cb5222fc4 100644 (file)
@@ -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 {