-
Notifications
You must be signed in to change notification settings - Fork 0
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
5 changed files
with
54 additions
and
36 deletions.
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
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,13 @@ | ||
#!/bin/bash -e | ||
|
||
function install-deepcopy-gen() { | ||
go install k8s.io/code-generator/cmd/deepcopy-gen | ||
} | ||
|
||
function run-deepcopy-gen() { | ||
local output_file="${1}" | ||
deepcopy-gen \ | ||
--output-file zz_generated.deepcopy.go \ | ||
--go-header-file scripts/header-template.go.tmpl \ | ||
"${output_file}" | ||
} |
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,23 +1,11 @@ | ||
#!/bin/bash -e | ||
|
||
go install k8s.io/code-generator/cmd/deepcopy-gen | ||
TMP_DIR=$(mktemp -d) | ||
trap "rm -rf $TMP_DIR" EXIT | ||
set -x | ||
|
||
# konnect package | ||
deepcopy-gen --input-dirs github.com/kong/go-database-reconciler/pkg/konnect \ | ||
-O zz_generated.deepcopy \ | ||
--go-header-file scripts/header-template.go.tmpl \ | ||
--output-base $TMP_DIR | ||
SCRIPT_DIR="$(dirname $0)" | ||
source ${SCRIPT_DIR}/_lib.sh | ||
|
||
cp $TMP_DIR/github.com/kong/go-database-reconciler/pkg/konnect/zz_generated.deepcopy.go \ | ||
pkg/konnect/zz_generated.deepcopy.go | ||
install-deepcopy-gen | ||
|
||
# file package | ||
deepcopy-gen --input-dirs github.com/kong/go-database-reconciler/pkg/file \ | ||
-O zz_generated.deepcopy \ | ||
--go-header-file scripts/header-template.go.tmpl \ | ||
--output-base $TMP_DIR | ||
|
||
cp $TMP_DIR/github.com/kong/go-database-reconciler/pkg/file/zz_generated.deepcopy.go \ | ||
pkg/file/zz_generated.deepcopy.go | ||
run-deepcopy-gen ./pkg/konnect | ||
run-deepcopy-gen ./pkg/file |
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,7 +1,12 @@ | ||
#!/bin/bash -e | ||
|
||
FILE="kong_json_schema.json" | ||
cp file/${FILE} /tmp/${FILE} | ||
set -x | ||
|
||
SCHEMA_FILE_NAME="kong_json_schema.json" | ||
SOURCE_FILE_PATH="pkg/file/${SCHEMA_FILE_NAME}" | ||
TMP_SCHEMA_FILE_PATH="/tmp/${SCHEMA_FILE_NAME}" | ||
|
||
cp "${SOURCE_FILE_PATH}" "${TMP_SCHEMA_FILE_PATH}" | ||
go generate ./... | ||
|
||
diff -u /tmp/${FILE} file/${FILE} | ||
diff -u "${TMP_SCHEMA_FILE_PATH}" "${SOURCE_FILE_PATH}" |
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,23 +1,24 @@ | ||
#!/bin/bash -e | ||
|
||
go install k8s.io/code-generator/cmd/deepcopy-gen | ||
set -x | ||
|
||
SCRIPT_DIR="$(dirname $0)" | ||
source ${SCRIPT_DIR}/_lib.sh | ||
|
||
TMP_DIR=$(mktemp -d) | ||
trap "rm -rf $TMP_DIR" EXIT | ||
|
||
# konnect package | ||
deepcopy-gen --input-dirs github.com/kong/go-database-reconciler/pkg/konnect \ | ||
-O zz_generated.deepcopy \ | ||
--go-header-file scripts/header-template.go.tmpl \ | ||
--output-base $TMP_DIR | ||
function run-deepcopy-and-diff() { | ||
local pkg="${1}" | ||
|
||
cp ./pkg/${pkg}/zz_generated.deepcopy.go ${TMP_DIR}/${pkg}.zz_generated.deepcopy.go | ||
run-deepcopy-gen ./pkg/${pkg} | ||
|
||
diff -Naur konnect/zz_generated.deepcopy.go \ | ||
$TMP_DIR/github.com/kong/go-database-reconciler/pkg/konnect/zz_generated.deepcopy.go | ||
diff -Naur ./pkg/${pkg}/zz_generated.deepcopy.go \ | ||
${TMP_DIR}/${pkg}.zz_generated.deepcopy.go | ||
} | ||
|
||
# file package | ||
deepcopy-gen --input-dirs github.com/kong/go-database-reconciler/pkg/file \ | ||
-O zz_generated.deepcopy \ | ||
--go-header-file scripts/header-template.go.tmpl \ | ||
--output-base $TMP_DIR | ||
install-deepcopy-gen | ||
|
||
diff -Naur file/zz_generated.deepcopy.go \ | ||
$TMP_DIR/github.com/kong/go-database-reconciler/pkg/file/zz_generated.deepcopy.go | ||
run-deepcopy-and-diff konnect | ||
run-deepcopy-and-diff file |