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/api | |
| 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/api')
| -rw-r--r-- | src/cmd/api/goapi.go | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/cmd/api/goapi.go b/src/cmd/api/goapi.go index 906cd3a68d..0d76b0cdb6 100644 --- a/src/cmd/api/goapi.go +++ b/src/cmd/api/goapi.go @@ -778,8 +778,7 @@ func (w *Walker) walkConst(vs *ast.ValueSpec) { } } } - if strings.HasPrefix(litType, constDepPrefix) { - dep := litType[len(constDepPrefix):] + if dep := strings.TrimPrefix(litType, constDepPrefix); dep != litType { w.constDep[ident.Name] = dep continue } |
