Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use go1.16's module aware install vs tools.go #1028

Merged
merged 1 commit into from
Jun 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,25 @@ require (
github.com/docker/docker-credential-helpers v0.6.3 // indirect
github.com/docker/go-connections v0.4.0 // indirect
github.com/docker/go-units v0.4.0 // indirect
github.com/gogo/protobuf v1.3.1 // indirect
github.com/google/go-cmp v0.5.2
github.com/gorilla/mux v1.7.3 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/maxbrunsfeld/counterfeiter/v6 v6.2.2
github.com/morikuni/aec v1.0.0 // indirect
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
github.com/onsi/ginkgo v1.12.0 // indirect
github.com/onsi/gomega v1.9.0 // indirect
github.com/opencontainers/image-spec v1.0.1
github.com/sirupsen/logrus v1.6.0 // indirect
github.com/spf13/cobra v1.0.0
github.com/spf13/pflag v1.0.5 // indirect
github.com/stretchr/testify v1.6.1 // indirect
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b // indirect
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a
golang.org/x/text v0.3.4 // indirect
golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1 // indirect
golang.org/x/tools v0.0.0-20200916195026-c9a70fc28ce3 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
google.golang.org/genproto v0.0.0-20200527145253-8367513e4ece // indirect
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect
gopkg.in/yaml.v2 v2.3.0 // indirect
gotest.tools v2.2.0+incompatible // indirect
k8s.io/code-generator v0.19.7
k8s.io/gengo v0.0.0-20201113003025-83324d819ded // indirect
k8s.io/klog/v2 v2.4.0 // indirect
)
104 changes: 0 additions & 104 deletions go.sum

Large diffs are not rendered by default.

26 changes: 21 additions & 5 deletions hack/update-codegen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ set -o nounset
set -o pipefail

PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
export BOILER_PLATE_FILE="${PROJECT_ROOT}/hack/boilerplate/boilerplate.go.txt"
BOILER_PLATE_FILE="${PROJECT_ROOT}/hack/boilerplate/boilerplate.go.txt"
MODULE_NAME=github.com/google/go-containerregistry

pushd ${PROJECT_ROOT}
trap popd EXIT
Expand All @@ -29,8 +30,23 @@ export PATH="${GOPATH}/bin:${PATH}"

go mod tidy
go mod vendor
go run $PROJECT_ROOT/cmd/crane/help/main.go --dir=$PROJECT_ROOT/cmd/crane/doc/

go run ./vendor/github.com/maxbrunsfeld/counterfeiter/v6/ -o pkg/v1/fake/index.go ${PROJECT_ROOT}/pkg/v1 ImageIndex
go run ./vendor/github.com/maxbrunsfeld/counterfeiter/v6/ -o pkg/v1/fake/image.go ${PROJECT_ROOT}/pkg/v1 Image
go run ./vendor/k8s.io/code-generator/cmd/deepcopy-gen -O zz_deepcopy_generated --go-header-file $BOILER_PLATE_FILE -i github.com/google/go-containerregistry/pkg/v1
export GOBIN=$(mktemp -d)
export PATH="$GOBIN:$PATH"

go install github.com/maxbrunsfeld/counterfeiter/v6@latest
go install k8s.io/code-generator/cmd/deepcopy-gen@v0.20.7

counterfeiter -o pkg/v1/fake/index.go ${PROJECT_ROOT}/pkg/v1 ImageIndex
counterfeiter -o pkg/v1/fake/image.go ${PROJECT_ROOT}/pkg/v1 Image

DEEPCOPY_OUTPUT=$(mktemp -d)

deepcopy-gen -O zz_deepcopy_generated --go-header-file $BOILER_PLATE_FILE \
--input-dirs "$MODULE_NAME/pkg/v1" \
--output-base "$DEEPCOPY_OUTPUT"

# TODO - Generalize this for all directories when we need it
cp $DEEPCOPY_OUTPUT/$MODULE_NAME/pkg/v1/*.go $PROJECT_ROOT/pkg/v1

go run $PROJECT_ROOT/cmd/crane/help/main.go --dir=$PROJECT_ROOT/cmd/crane/doc/
77 changes: 44 additions & 33 deletions pkg/v1/fake/image.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading