Skip to content

Commit

Permalink
Removing the vendor dir (knative#1966)
Browse files Browse the repository at this point in the history
  • Loading branch information
cardil authored Sep 25, 2023
1 parent 975cc91 commit b6fb880
Show file tree
Hide file tree
Showing 9,140 changed files with 9,086 additions and 2,271,346 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
1 change: 0 additions & 1 deletion .codecov.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,4 @@ ignore:
- "hack"
- "test"
- "third_party"
- "vendor"

5 changes: 0 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,3 @@ __pycache__

# Operating system temporary files
.DS_Store

# Non relevant vendor files
BUILD.bazel
OWNERS
OWNERS_ALIASES
5 changes: 1 addition & 4 deletions .unicode-control-characters.config.py
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']
]
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ require (
k8s.io/client-go v0.26.5
knative.dev/client-pkg v0.0.0-20230815131440-5abd12981b4b
knative.dev/eventing v0.38.1-0.20230831151434-10e25b91d471
knative.dev/hack v0.0.0-20230818155117-9cc05a31e8c0
knative.dev/hack v0.0.0-20230925132200-74aa02a8beeb
knative.dev/pkg v0.0.0-20230829134737-fcccb4e1a0a4
knative.dev/serving v0.38.1-0.20230831173934-8dbb2d35192a
)
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1549,8 +1549,8 @@ knative.dev/client-pkg v0.0.0-20230815131440-5abd12981b4b h1:Ln3mDUER89kC4sYHkCp
knative.dev/client-pkg v0.0.0-20230815131440-5abd12981b4b/go.mod h1:GRVZm1rKOy0lpPBGRM1ugK5joDbhXFEvULINHqPoA9U=
knative.dev/eventing v0.38.1-0.20230831151434-10e25b91d471 h1:7AECKT0v4Kq/zkeIMIE6sZNzGhXPuWxLM64XbiLPvVE=
knative.dev/eventing v0.38.1-0.20230831151434-10e25b91d471/go.mod h1:dWcR2GxWiNhMCV65YxbTBvj5V+E8R5nN6sd8qbyLnbY=
knative.dev/hack v0.0.0-20230818155117-9cc05a31e8c0 h1:n9YEGYuoj31pAkhGlNL+xTQAeXKYTLeMmIZLWA9fAeo=
knative.dev/hack v0.0.0-20230818155117-9cc05a31e8c0/go.mod h1:yk2OjGDsbEnQjfxdm0/HJKS2WqTLEFg/N6nUs6Rqx3Q=
knative.dev/hack v0.0.0-20230925132200-74aa02a8beeb h1:GYlj0vJBoye0mtCbgZddyMTXIzgSRihRruaCnCffBSI=
knative.dev/hack v0.0.0-20230925132200-74aa02a8beeb/go.mod h1:yk2OjGDsbEnQjfxdm0/HJKS2WqTLEFg/N6nUs6Rqx3Q=
knative.dev/networking v0.0.0-20230830115731-dfd6edf47b91 h1:D3Pca9E6Jk7w2QmDaXeSjSRL2apMMA57Dtjt8efgii8=
knative.dev/networking v0.0.0-20230830115731-dfd6edf47b91/go.mod h1:1voQlQD0tuot6U3Kldw+uch33mK2LV85fi3MfbV0CP8=
knative.dev/pkg v0.0.0-20230829134737-fcccb4e1a0a4 h1:UKse4ZRulN2Xif4agvPbvUAxSsDlLLJTy/mrHp9CRN4=
Expand Down
2 changes: 1 addition & 1 deletion hack/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
ORG_NAME=knative
VALIDATION_TESTS="make test"

source $(dirname $0)/../vendor/knative.dev/hack/release.sh
source "$(go run knative.dev/hack/cmd/script release.sh)"

PIPELINE_ARTIFACTS="pkg/pipelines/resources/tekton/task/func-buildpacks/0.2/func-buildpacks.yaml pkg/pipelines/resources/tekton/task/func-deploy/0.1/func-deploy.yaml pkg/pipelines/resources/tekton/task/func-s2i/0.1/func-s2i.yaml"

Expand Down
2 changes: 1 addition & 1 deletion hack/tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ limitations under the License.
package tools

import (
_ "knative.dev/hack"
_ "knative.dev/hack/cmd/script"
)
2 changes: 1 addition & 1 deletion hack/update-codegen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ set -o errexit
set -o nounset
set -o pipefail

source $(dirname $0)/../vendor/knative.dev/hack/library.sh
source "$(go run knative.dev/hack/cmd/script library.sh)"

# Make sure our dependencies are up-to-date
${REPO_ROOT_DIR}/hack/update-deps.sh
2 changes: 1 addition & 1 deletion hack/update-deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ set -o errexit
set -o nounset
set -o pipefail

source $(dirname "$0")/../vendor/knative.dev/hack/library.sh
source "$(go run knative.dev/hack/cmd/script library.sh)"

go_update_deps "$@"
7 changes: 3 additions & 4 deletions hack/verify-codegen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ set -o errexit
set -o nounset
set -o pipefail

source $(dirname $0)/../vendor/knative.dev/hack/library.sh
source "$(go run knative.dev/hack/cmd/script library.sh)"

readonly TMP_DIFFROOT="$(mktemp -d ${REPO_ROOT_DIR}/tmpdiffroot.XXXXXX)"

Expand All @@ -29,16 +29,15 @@ cleanup() {
trap "cleanup" EXIT SIGINT

# Save working tree state
cp -aR "${REPO_ROOT_DIR}/go.sum" "${REPO_ROOT_DIR}/vendor" "${TMP_DIFFROOT}"
cp -aR "${REPO_ROOT_DIR}/go.sum" "${TMP_DIFFROOT}"

"${REPO_ROOT_DIR}/hack/update-codegen.sh"
echo "Diffing ${REPO_ROOT_DIR} against freshly generated codegen"
ret=0
diff -Nupr --no-dereference "${REPO_ROOT_DIR}/go.sum" "${TMP_DIFFROOT}/go.sum" || ret=1
diff -Nupr --no-dereference "${REPO_ROOT_DIR}/vendor" "${TMP_DIFFROOT}/vendor" || ret=1

# Restore working tree state
rm -fr "${REPO_ROOT_DIR}/go.sum" "${REPO_ROOT_DIR}/vendor"
rm -fr "${REPO_ROOT_DIR}/go.sum"
cp -aR "${TMP_DIFFROOT}"/* "${REPO_ROOT_DIR}"

if [[ $ret -eq 0 ]]
Expand Down
2 changes: 1 addition & 1 deletion test/presubmit-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export NODE_DISTRO=linux-x64

export KNATIVE_SERVING_VERSION=${KNATIVE_SERVING_VERSION:-latest}
export KNATIVE_EVENTING_VERSION=${KNATIVE_EVENTING_VERSION:-latest}
source "$(dirname "$0")/../vendor/knative.dev/hack/presubmit-tests.sh"
source "$(go run knative.dev/hack/cmd/script presubmit-tests.sh)"

FUNC_REPO_BRANCH_REF="${PULL_PULL_SHA}"
export FUNC_REPO_BRANCH_REF
Expand Down
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")
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module github.com/hashicorp/errwrap
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module github.com/hashicorp/go-cleanhttp

go 1.13
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)
}
})
}
}
Loading

0 comments on commit b6fb880

Please sign in to comment.