From e515d80d5dfd5621a16f6fc9f08cc3c0958a8414 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Fri, 1 Feb 2013 08:41:25 -0800 Subject: 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 --- src/cmd/api/goapi.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/cmd/api') 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 } -- cgit v1.3