mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-07-01 18:30:15 +00:00
Add all dependency of go-getter
This commit is contained in:
23
vendor/github.com/aws/aws-sdk-go/internal/sdkuri/path.go
generated
vendored
Normal file
23
vendor/github.com/aws/aws-sdk-go/internal/sdkuri/path.go
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
package sdkuri
|
||||
|
||||
import (
|
||||
"path"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// PathJoin will join the elements of the path delimited by the "/"
|
||||
// character. Similar to path.Join with the exception the trailing "/"
|
||||
// character is preserved if present.
|
||||
func PathJoin(elems ...string) string {
|
||||
if len(elems) == 0 {
|
||||
return ""
|
||||
}
|
||||
|
||||
hasTrailing := strings.HasSuffix(elems[len(elems)-1], "/")
|
||||
str := path.Join(elems...)
|
||||
if hasTrailing && str != "/" {
|
||||
str += "/"
|
||||
}
|
||||
|
||||
return str
|
||||
}
|
||||
21
vendor/github.com/aws/aws-sdk-go/internal/sdkuri/path_test.go
generated
vendored
Normal file
21
vendor/github.com/aws/aws-sdk-go/internal/sdkuri/path_test.go
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
package sdkuri
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestPathJoin(t *testing.T) {
|
||||
cases := []struct {
|
||||
Elems []string
|
||||
Expect string
|
||||
}{
|
||||
{Elems: []string{"/"}, Expect: "/"},
|
||||
{Elems: []string{}, Expect: ""},
|
||||
{Elems: []string{"blah", "el", "blah/"}, Expect: "blah/el/blah/"},
|
||||
{Elems: []string{"/asd", "asdfa", "asdfasd/"}, Expect: "/asd/asdfa/asdfasd/"},
|
||||
{Elems: []string{"asdfa", "asdfa", "asdfads"}, Expect: "asdfa/asdfa/asdfads"},
|
||||
}
|
||||
for _, c := range cases {
|
||||
if e, a := c.Expect, PathJoin(c.Elems...); e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user