Skip to content

Commit 594483f

Browse files
committed
.github/workflows: .github/workflows: go-generate-check changed logic for whitelisting changes in generated files directly
The intention of this commit is to not break/change the logic for developers when coding. This script serves as a warning notification if a developer forgets to generate those files using gencodec. On specific cases where generated files are modified, we revert the modifications and compare the files so as they will show up any changes in the original files. The developer then will find out the correct way to resolve generating the new files and keeping the modifications intact if needed.
1 parent 633eae8 commit 594483f

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

.github/workflows/go-generate-check.yml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,6 @@ env:
88
# https://github.com/ethereum/go-ethereum/blob/master/accounts/usbwallet/trezor/trezor.go#L21-L43
99
GENERATE_EXCEPTIONS: |
1010
trezor
11-
# GENERATE_IGNORES are applied after the 'go generate' command.
12-
# These files will be reverted after 'go generate' to their original ref version.
13-
#
14-
# - gen_genesis.go: file which has custom modifications for unmarshaling the various genesis formats
15-
GENERATE_IGNORES: |
16-
params/types/genesisT/gen_genesis.go
1711
jobs:
1812
go-generate-check:
1913
name: Check if "go generate" has been run
@@ -46,10 +40,17 @@ jobs:
4640
list="$(grep -v "$pattern" <<< "$list")"
4741
done
4842
go generate "$list"
49-
- name: Skip whitelisted generated go files
50-
id: skip-files
43+
- name: Revert custom generated files modifications before comparing them
44+
id: revert-custom-generated-modifications
5145
run: |
52-
git checkout -- ${GENERATE_IGNORES[@]}
46+
# NOTE to developers checking what triggered this alert.
47+
# This script is meant to alert you if some files have to be regenerated using `go generate`.
48+
# If this happens, you have to run `go generate ./...` and then check the below commits that are being reverted and reapply them, after considering if they are needed.
49+
50+
# Intentionally revert this commit which has a custom modification to the genesis unmarshaling,
51+
# with regards reading different genesis formats origniating from different clients
52+
# This way, this script can alert us on any code changes that have to be applied on if file gets changed.
53+
git revert --no-edit 4b2cf83737ffe7c46c334a11414d151de049e0b3
5354
5455
- name: Check for modified files
5556
id: git-check

0 commit comments

Comments
 (0)