build: add imports for go generate tools (#24682)
This adds a tools.go file to import all command packages used for go:generate. Doing so makes it possible to execute go-based code generators using 'go run', locking in the tool version using go.mod. Co-authored-by: Felix Lange <fjl@twurst.com>
This commit is contained in:
@ -66,7 +66,7 @@ type btBlock struct {
|
||||
UncleHeaders []*btHeader
|
||||
}
|
||||
|
||||
//go:generate gencodec -type btHeader -field-override btHeaderMarshaling -out gen_btheader.go
|
||||
//go:generate go run github.com/fjl/gencodec -type btHeader -field-override btHeaderMarshaling -out gen_btheader.go
|
||||
|
||||
type btHeader struct {
|
||||
Bloom types.Bloom
|
||||
|
@ -27,7 +27,7 @@ import (
|
||||
"github.com/ethereum/go-ethereum/params"
|
||||
)
|
||||
|
||||
//go:generate gencodec -type DifficultyTest -field-override difficultyTestMarshaling -out gen_difficultytest.go
|
||||
//go:generate go run github.com/fjl/gencodec -type DifficultyTest -field-override difficultyTestMarshaling -out gen_difficultytest.go
|
||||
|
||||
type DifficultyTest struct {
|
||||
ParentTimestamp uint64 `json:"parentTimestamp"`
|
||||
|
@ -18,11 +18,11 @@ func (s stEnv) MarshalJSON() ([]byte, error) {
|
||||
type stEnv struct {
|
||||
Coinbase common.UnprefixedAddress `json:"currentCoinbase" gencodec:"required"`
|
||||
Difficulty *math.HexOrDecimal256 `json:"currentDifficulty" gencodec:"optional"`
|
||||
Random *math.HexOrDecimal256 `json:"currentRandom" gencodec:"optional"`
|
||||
Random *math.HexOrDecimal256 `json:"currentRandom" gencodec:"optional"`
|
||||
GasLimit math.HexOrDecimal64 `json:"currentGasLimit" gencodec:"required"`
|
||||
Number math.HexOrDecimal64 `json:"currentNumber" gencodec:"required"`
|
||||
Timestamp math.HexOrDecimal64 `json:"currentTimestamp" gencodec:"required"`
|
||||
BaseFee *math.HexOrDecimal256 `json:"currentBaseFee" gencodec:"optional"`
|
||||
BaseFee *math.HexOrDecimal256 `json:"currentBaseFee" gencodec:"optional"`
|
||||
}
|
||||
var enc stEnv
|
||||
enc.Coinbase = common.UnprefixedAddress(s.Coinbase)
|
||||
@ -40,11 +40,11 @@ func (s *stEnv) UnmarshalJSON(input []byte) error {
|
||||
type stEnv struct {
|
||||
Coinbase *common.UnprefixedAddress `json:"currentCoinbase" gencodec:"required"`
|
||||
Difficulty *math.HexOrDecimal256 `json:"currentDifficulty" gencodec:"optional"`
|
||||
Random *math.HexOrDecimal256 `json:"currentRandom" gencodec:"optional"`
|
||||
Random *math.HexOrDecimal256 `json:"currentRandom" gencodec:"optional"`
|
||||
GasLimit *math.HexOrDecimal64 `json:"currentGasLimit" gencodec:"required"`
|
||||
Number *math.HexOrDecimal64 `json:"currentNumber" gencodec:"required"`
|
||||
Timestamp *math.HexOrDecimal64 `json:"currentTimestamp" gencodec:"required"`
|
||||
BaseFee *math.HexOrDecimal256 `json:"currentBaseFee" gencodec:"optional"`
|
||||
BaseFee *math.HexOrDecimal256 `json:"currentBaseFee" gencodec:"optional"`
|
||||
}
|
||||
var dec stEnv
|
||||
if err := json.Unmarshal(input, &dec); err != nil {
|
||||
|
@ -76,7 +76,7 @@ type stPostState struct {
|
||||
}
|
||||
}
|
||||
|
||||
//go:generate gencodec -type stEnv -field-override stEnvMarshaling -out gen_stenv.go
|
||||
//go:generate go run github.com/fjl/gencodec -type stEnv -field-override stEnvMarshaling -out gen_stenv.go
|
||||
|
||||
type stEnv struct {
|
||||
Coinbase common.Address `json:"currentCoinbase" gencodec:"required"`
|
||||
@ -98,7 +98,7 @@ type stEnvMarshaling struct {
|
||||
BaseFee *math.HexOrDecimal256
|
||||
}
|
||||
|
||||
//go:generate gencodec -type stTransaction -field-override stTransactionMarshaling -out gen_sttransaction.go
|
||||
//go:generate go run github.com/fjl/gencodec -type stTransaction -field-override stTransactionMarshaling -out gen_sttransaction.go
|
||||
|
||||
type stTransaction struct {
|
||||
GasPrice *big.Int `json:"gasPrice"`
|
||||
|
Reference in New Issue
Block a user