From d0b0cbfb27197e2560e9de031a806f94a085cd56 Mon Sep 17 00:00:00 2001 From: Darren Kelly Date: Tue, 26 Nov 2024 12:28:47 +0000 Subject: [PATCH 1/2] chore: update builtin generation --- .github/workflows/lint-go.yaml | 7 +++++++ builtin/gen/bindata.go | 27 +++++++++------------------ builtin/gen/gen.go | 5 +++-- 3 files changed, 19 insertions(+), 20 deletions(-) diff --git a/.github/workflows/lint-go.yaml b/.github/workflows/lint-go.yaml index ea4d2195a..85e65b29c 100644 --- a/.github/workflows/lint-go.yaml +++ b/.github/workflows/lint-go.yaml @@ -17,6 +17,13 @@ jobs: with: go-version: '1.22' cache: false + - name: Go Generate + run: go generate ./... + + - name: Check `builtins` directory + # if it has any changes in the 'builtins' dir after running `go generate`, echo an error and fail the workflow + run: git diff --exit-code builtin/gen || (echo "\n\n\nbuiltin/gen directory is not up to date, run 'go generate ./...' to update it" && exit 1) + - name: golangci-lint uses: golangci/golangci-lint-action@v6 with: diff --git a/builtin/gen/bindata.go b/builtin/gen/bindata.go index 8f1ffbc5d..c0724a53d 100644 --- a/builtin/gen/bindata.go +++ b/builtin/gen/bindata.go @@ -1,4 +1,4 @@ -// Package gen Code generated by go-bindata. (@generated) DO NOT EDIT. +// Code generated by go-bindata. DO NOT EDIT. // sources: // compiled/Authority.abi // compiled/Authority.bin-runtime @@ -76,32 +76,21 @@ type bindataFileInfo struct { modTime time.Time } -// Name return file name func (fi bindataFileInfo) Name() string { return fi.name } - -// Size return file size func (fi bindataFileInfo) Size() int64 { return fi.size } - -// Mode return file mode func (fi bindataFileInfo) Mode() os.FileMode { return fi.mode } - -// Mode return file modify time func (fi bindataFileInfo) ModTime() time.Time { return fi.modTime } - -// IsDir return file whether a directory func (fi bindataFileInfo) IsDir() bool { - return fi.mode&os.ModeDir != 0 + return false } - -// Sys return file is sys mode func (fi bindataFileInfo) Sys() interface{} { return nil } @@ -794,11 +783,13 @@ var _bindata = map[string]func() (*asset, error){ // directory embedded in the file by go-bindata. // For example if you run go-bindata on data/... and data contains the // following hierarchy: -// data/ -// foo.txt -// img/ -// a.png -// b.png +// +// data/ +// foo.txt +// img/ +// a.png +// b.png +// // then AssetDir("data") would return []string{"foo.txt", "img"} // AssetDir("data/img") would return []string{"a.png", "b.png"} // AssetDir("foo.txt") and AssetDir("notexist") would return an error diff --git a/builtin/gen/gen.go b/builtin/gen/gen.go index d08c2f179..ce5fed8e1 100644 --- a/builtin/gen/gen.go +++ b/builtin/gen/gen.go @@ -6,5 +6,6 @@ package gen //go:generate rm -rf ./compiled/ -//go:generate solc --optimize-runs 200 --overwrite --bin-runtime --abi -o ./compiled authority.sol energy.sol executor.sol extension.sol extension-v2.sol measure.sol params.sol prototype.sol -//go:generate go-bindata -nometadata -ignore=_ -pkg gen -o bindata.go compiled/ +//go:generate docker run -v ./:/solidity ethereum/solc:0.4.24 --optimize-runs 200 --overwrite --bin-runtime --abi -o /solidity/compiled authority.sol energy.sol executor.sol extension.sol extension-v2.sol measure.sol params.sol prototype.sol +//go:generate go run github.com/go-bindata/go-bindata/go-bindata@v1.0.0 -nometadata -ignore=_ -pkg gen -o bindata.go compiled/ +//go:generate go fmt From 683389b6338e1835c8b024851afb82dcba28d551 Mon Sep 17 00:00:00 2001 From: Darren Kelly Date: Tue, 26 Nov 2024 12:33:24 +0000 Subject: [PATCH 2/2] fix: update GHA --- .github/workflows/lint-go.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/lint-go.yaml b/.github/workflows/lint-go.yaml index 85e65b29c..0f49ceb39 100644 --- a/.github/workflows/lint-go.yaml +++ b/.github/workflows/lint-go.yaml @@ -17,12 +17,12 @@ jobs: with: go-version: '1.22' cache: false - - name: Go Generate - run: go generate ./... - name: Check `builtins` directory # if it has any changes in the 'builtins' dir after running `go generate`, echo an error and fail the workflow - run: git diff --exit-code builtin/gen || (echo "\n\n\nbuiltin/gen directory is not up to date, run 'go generate ./...' to update it" && exit 1) + run: | + go generate ./builtin/gen + git diff --exit-code builtin/gen || (echo "\n\n\nbuiltin/gen directory is not up to date, run 'go generate ./...' to update it" && exit 1) - name: golangci-lint uses: golangci/golangci-lint-action@v6