1 // Copyright 2011 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
7 func isExist(err error
) bool {
8 switch pe
:= err
.(type) {
16 return contains(err
.Error(), " exists")
19 func isNotExist(err error
) bool {
20 switch pe
:= err
.(type) {
28 return contains(err
.Error(), "does not exist")
31 func isPermission(err error
) bool {
32 switch pe
:= err
.(type) {
40 return contains(err
.Error(), "permission denied")
43 // contains is a local version of strings.Contains. It knows len(sep) > 1.
44 func contains(s
, sep
string) bool {
47 for i
:= 0; i
+n
<= len(s
); i
++ {
48 if s
[i
] == c
&& s
[i
:i
+n
] == sep
{