misc, docs: Move to golang 1.12
This commit is contained in:
@@ -43,7 +43,7 @@ const (
|
||||
// false if not.
|
||||
func modeIsValidWho(who string) bool {
|
||||
for _, w := range []string{"u", "g", "o"} {
|
||||
who = strings.Replace(who, w, "", -1) // TODO: use ReplaceAll in 1.12
|
||||
who = strings.ReplaceAll(who, w, "")
|
||||
}
|
||||
return len(who) == 0
|
||||
}
|
||||
@@ -52,7 +52,7 @@ func modeIsValidWho(who string) bool {
|
||||
// string ('r', 'w', 'x', 's', 't').
|
||||
func modeIsValidWhat(what string) bool {
|
||||
for _, w := range []string{"r", "w", "x", "s", "t"} {
|
||||
what = strings.Replace(what, w, "", -1) // TODO: use ReplaceAll in 1.12
|
||||
what = strings.ReplaceAll(what, w, "")
|
||||
}
|
||||
return len(what) == 0
|
||||
}
|
||||
|
||||
@@ -70,9 +70,9 @@ func ResPathUID(res engine.Res) string {
|
||||
// a name of: /tmp/mgmt/foo is /tmp-mgmt-foo and
|
||||
// a name of: /tmp/mgmt-foo -> /tmp-mgmt-foo if we replace slashes.
|
||||
// As a result, we base64 encode (but without slashes).
|
||||
name := strings.Replace(res.Name(), "/", "-", -1) // TODO: use ReplaceAll in 1.12
|
||||
if os.PathSeparator != '/' { // lol windows?
|
||||
name = strings.Replace(name, string(os.PathSeparator), "-", -1) // TODO: use ReplaceAll in 1.12
|
||||
name := strings.ReplaceAll(res.Name(), "/", "-")
|
||||
if os.PathSeparator != '/' { // lol windows?
|
||||
name = strings.ReplaceAll(name, string(os.PathSeparator), "-")
|
||||
}
|
||||
b := []byte(res.Name())
|
||||
encoded := base64.URLEncoding.EncodeToString(b)
|
||||
|
||||
Reference in New Issue
Block a user