mirror of
https://github.com/golang/go.git
synced 2025-10-28 07:14:14 +00:00
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
This commit is contained in:
parent
fe14ee52cc
commit
e515d80d5d
21 changed files with 117 additions and 54 deletions
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue