diff options
| author | Brad Fitzpatrick <bradfitz@golang.org> | 2013-02-01 08:41:25 -0800 |
|---|---|---|
| committer | Brad Fitzpatrick <bradfitz@golang.org> | 2013-02-01 08:41:25 -0800 |
| commit | e515d80d5dfd5621a16f6fc9f08cc3c0958a8414 (patch) | |
| tree | 343538fd82efacfb61675e27dc2ebf19b0b6057e /src/cmd/fix/typecheck.go | |
| parent | fe14ee52ccf89fa02366a06fe892a7fcf135e214 (diff) | |
| download | go-e515d80d5dfd5621a16f6fc9f08cc3c0958a8414.tar.xz | |
bytes, strings: add TrimPrefix and TrimSuffix
Everybody either gets confused and thinks this is
TrimLeft/TrimRight or does this by hand which gets
repetitive looking.
R=rsc, kevlar
CC=golang-dev
https://golang.org/cl/7239044
Diffstat (limited to 'src/cmd/fix/typecheck.go')
| -rw-r--r-- | src/cmd/fix/typecheck.go | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/cmd/fix/typecheck.go b/src/cmd/fix/typecheck.go index d54d375478..d33b69fddc 100644 --- a/src/cmd/fix/typecheck.go +++ b/src/cmd/fix/typecheck.go @@ -395,9 +395,7 @@ func typecheck1(cfg *TypeConfig, f interface{}, typeof map[interface{}]string, a // Field or method. name := n.Sel.Name if t := typeof[n.X]; t != "" { - if strings.HasPrefix(t, "*") { - t = t[1:] // implicit * - } + t = strings.TrimPrefix(t, "*") // implicit * if typ := cfg.Type[t]; typ != nil { if t := typ.dot(cfg, name); t != "" { typeof[n] = t |
