diff options
| author | Joseph Richey <joerichey94@gmail.com> | 2018-02-11 20:34:07 -0800 |
|---|---|---|
| committer | Joseph Richey <joerichey94@gmail.com> | 2018-02-11 20:34:07 -0800 |
| commit | 23b8c7b4eab0375b3d59cf4b2a1f3d7356515f95 (patch) | |
| tree | 6ec67f8d6b15420c3870d2b7c43b2b636fbb8349 /vendor/github.com/kisielk/gotool/internal/load/path.go | |
| parent | fff13ea9041a3945e36d5f002c3c0a1e0e93c825 (diff) | |
vendor: include source for tools
This change vendors the source for all our build, formatting, and
linting tools. Generated by running "dep ensure".
Diffstat (limited to 'vendor/github.com/kisielk/gotool/internal/load/path.go')
| -rw-r--r-- | vendor/github.com/kisielk/gotool/internal/load/path.go | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/vendor/github.com/kisielk/gotool/internal/load/path.go b/vendor/github.com/kisielk/gotool/internal/load/path.go new file mode 100644 index 0000000..74e15b9 --- /dev/null +++ b/vendor/github.com/kisielk/gotool/internal/load/path.go @@ -0,0 +1,27 @@ +// Copyright 2017 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build go1.9 + +package load + +import ( + "strings" +) + +// hasPathPrefix reports whether the path s begins with the +// elements in prefix. +func hasPathPrefix(s, prefix string) bool { + switch { + default: + return false + case len(s) == len(prefix): + return s == prefix + case len(s) > len(prefix): + if prefix != "" && prefix[len(prefix)-1] == '/' { + return strings.HasPrefix(s, prefix) + } + return s[len(prefix)] == '/' && s[:len(prefix)] == prefix + } +} |