You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
.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.
# 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
17
11
jobs:
18
12
go-generate-check:
19
13
name: Check if "go generate" has been run
@@ -46,10 +40,17 @@ jobs:
46
40
list="$(grep -v "$pattern" <<< "$list")"
47
41
done
48
42
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
51
45
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.
0 commit comments