-
Notifications
You must be signed in to change notification settings - Fork 139
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9,140 changed files
with
9,086 additions
and
2,271,347 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,4 @@ ignore: | |
- "templates" | ||
- "hack" | ||
- "test" | ||
- "third_party" | ||
- "vendor" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,2 @@ | ||
scan_exclude = [ | ||
# Readme in vendor dir line=17,title=unicode control characters ['\u200d'] | ||
r'vendor/github\.com/rivo/uniseg/README\.md', | ||
# doc.go in vendor dir line=34,title=unicode control characters ['\u200d'] | ||
r'./vendor/github\.com/rivo/uniseg/doc\.go'] | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,5 +20,5 @@ limitations under the License. | |
package tools | ||
|
||
import ( | ||
_ "knative.dev/hack" | ||
_ "knative.dev/hack/cmd/script" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
119 changes: 119 additions & 0 deletions
119
third_party/VENDOR-LICENSE/github.com/hashicorp/errwrap/errwrap_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
package errwrap | ||
|
||
import ( | ||
"errors" | ||
"fmt" | ||
"testing" | ||
) | ||
|
||
func TestWrappedError_impl(t *testing.T) { | ||
var _ error = new(wrappedError) | ||
} | ||
|
||
func TestGetAll(t *testing.T) { | ||
cases := []struct { | ||
Err error | ||
Msg string | ||
Len int | ||
}{ | ||
{}, | ||
{ | ||
fmt.Errorf("foo"), | ||
"foo", | ||
1, | ||
}, | ||
{ | ||
fmt.Errorf("bar"), | ||
"foo", | ||
0, | ||
}, | ||
{ | ||
Wrapf("bar", fmt.Errorf("foo")), | ||
"foo", | ||
1, | ||
}, | ||
{ | ||
Wrapf("{{err}}", fmt.Errorf("foo")), | ||
"foo", | ||
2, | ||
}, | ||
{ | ||
Wrapf("bar", Wrapf("baz", fmt.Errorf("foo"))), | ||
"foo", | ||
1, | ||
}, | ||
{ | ||
fmt.Errorf("foo: %w", fmt.Errorf("bar")), | ||
"foo: bar", | ||
1, | ||
}, | ||
{ | ||
fmt.Errorf("foo: %w", fmt.Errorf("bar")), | ||
"bar", | ||
1, | ||
}, | ||
} | ||
|
||
for i, tc := range cases { | ||
actual := GetAll(tc.Err, tc.Msg) | ||
if len(actual) != tc.Len { | ||
t.Fatalf("%d: bad: %#v", i, actual) | ||
} | ||
for _, v := range actual { | ||
if v.Error() != tc.Msg { | ||
t.Fatalf("%d: bad: %#v", i, actual) | ||
} | ||
} | ||
} | ||
} | ||
|
||
func TestGetAllType(t *testing.T) { | ||
cases := []struct { | ||
Err error | ||
Type interface{} | ||
Len int | ||
}{ | ||
{}, | ||
{ | ||
fmt.Errorf("foo"), | ||
"foo", | ||
0, | ||
}, | ||
{ | ||
fmt.Errorf("bar"), | ||
fmt.Errorf("foo"), | ||
1, | ||
}, | ||
{ | ||
Wrapf("bar", fmt.Errorf("foo")), | ||
fmt.Errorf("baz"), | ||
2, | ||
}, | ||
{ | ||
Wrapf("bar", Wrapf("baz", fmt.Errorf("foo"))), | ||
Wrapf("", nil), | ||
0, | ||
}, | ||
{ | ||
fmt.Errorf("one: %w", fmt.Errorf("two: %w", fmt.Errorf("three"))), | ||
fmt.Errorf("%w", errors.New("")), | ||
2, | ||
}, | ||
} | ||
|
||
for i, tc := range cases { | ||
actual := GetAllType(tc.Err, tc.Type) | ||
if len(actual) != tc.Len { | ||
t.Fatalf("%d: bad: %#v", i, actual) | ||
} | ||
} | ||
} | ||
|
||
func TestWrappedError_IsCompatibleWithErrorsUnwrap(t *testing.T) { | ||
inner := errors.New("inner error") | ||
err := Wrap(errors.New("outer"), inner) | ||
actual := errors.Unwrap(err) | ||
if actual != inner { | ||
t.Fatal("wrappedError did not unwrap to inner") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module github.com/hashicorp/errwrap |
3 changes: 3 additions & 0 deletions
3
third_party/VENDOR-LICENSE/github.com/hashicorp/go-cleanhttp/go.mod
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module github.com/hashicorp/go-cleanhttp | ||
|
||
go 1.13 |
72 changes: 72 additions & 0 deletions
72
third_party/VENDOR-LICENSE/github.com/hashicorp/go-cleanhttp/handlers_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
package cleanhttp | ||
|
||
import ( | ||
"fmt" | ||
"net/http" | ||
"net/http/httptest" | ||
"testing" | ||
) | ||
|
||
func TestPrintablePathCheckHandler(t *testing.T) { | ||
getTestHandler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { | ||
fmt.Fprintln(w, "Hello, client") | ||
}) | ||
|
||
cases := map[string]struct { | ||
path string | ||
expectCode int | ||
input *HandlerInput | ||
}{ | ||
"valid nil input": { | ||
path: "/valid", | ||
expectCode: http.StatusOK, | ||
input: nil, | ||
}, | ||
|
||
"valid empty error status": { | ||
path: "/valid", | ||
expectCode: http.StatusOK, | ||
input: &HandlerInput{}, | ||
}, | ||
|
||
"invalid newline": { | ||
path: "/invalid%0A", | ||
expectCode: http.StatusBadRequest, | ||
}, | ||
|
||
"invalid carriage return": { | ||
path: "/invalid%0D", | ||
expectCode: http.StatusBadRequest, | ||
}, | ||
|
||
"invalid null": { | ||
path: "/invalid%00", | ||
expectCode: http.StatusBadRequest, | ||
}, | ||
|
||
"invalid alternate status": { | ||
path: "/invalid%0A", | ||
expectCode: http.StatusInternalServerError, | ||
input: &HandlerInput{ | ||
ErrStatus: http.StatusInternalServerError, | ||
}, | ||
}, | ||
} | ||
|
||
for name, tc := range cases { | ||
t.Run(name, func(t *testing.T) { | ||
// Create test HTTP server | ||
ts := httptest.NewServer(PrintablePathCheckHandler(getTestHandler, tc.input)) | ||
defer ts.Close() | ||
|
||
res, err := http.Get(ts.URL + tc.path) | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
|
||
if tc.expectCode != res.StatusCode { | ||
t.Fatalf("expected %d, got :%d", tc.expectCode, res.StatusCode) | ||
} | ||
}) | ||
} | ||
} |
Oops, something went wrong.