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: .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
@@ -25,7 +19,9 @@ jobs:
25
19
with:
26
20
go-version: ^1.16
27
21
- name: Check out code into the Go module directory
28
-
uses: actions/checkout@v2
22
+
uses: actions/checkout@v3
23
+
with:
24
+
fetch-depth: 0
29
25
- name: Install deps
30
26
id: install-deps
31
27
run: |
@@ -46,10 +42,20 @@ jobs:
46
42
list="$(grep -v "$pattern" <<< "$list")"
47
43
done
48
44
go generate "$list"
49
-
- name: Skip whitelisted generated go files
50
-
id: skip-files
45
+
- name: Revert custom generated files modifications before comparing them
46
+
id: revert-custom-generated-modifications
51
47
run: |
52
-
git checkout -- ${GENERATE_IGNORES[@]}
48
+
# NOTE to developers checking what triggered this alert.
49
+
# This script is meant to alert you if some files have to be regenerated using `go generate`.
50
+
# 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.
0 commit comments