Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rlp/rlpgen: remove build tag #1724

Merged
merged 1 commit into from
Sep 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion core/types/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ func (s *BlockSolution) UnmarshalJSON(input []byte) error {
}

//go:generate go run github.com/fjl/gencodec -type Header -field-override headerMarshaling -out gen_header_json.go
//go:generate go run ../../rlp/rlpgen -type Header -out gen_header_rlp.go

// Header represents a block header in the Cortex blockchain.
type Header struct {
Expand Down
3 changes: 0 additions & 3 deletions core/types/gen_account_rlp.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions core/types/gen_log_rlp.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion core/types/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"github.com/CortexFoundation/CortexTheseus/common/hexutil"
)

//go:generate go run ../../rlp/rlpgen -norlpgen=false -type Log -out gen_log_rlp.go
//go:generate go run ../../rlp/rlpgen -type Log -out gen_log_rlp.go
//go:generate go run github.com/fjl/gencodec -type Log -field-override logMarshaling -out gen_log_json.go

// Log represents a contract log event. These events are generated by the LOG opcode and
Expand Down
15 changes: 5 additions & 10 deletions rlp/rlpgen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ func main() {
output = flag.String("out", "-", "output file (default is stdout)")
genEncoder = flag.Bool("encoder", true, "generate EncodeRLP?")
genDecoder = flag.Bool("decoder", false, "generate DecodeRLP?")
norlpGen = flag.Bool("norlpgen", true, "apply norlpgen build tag")
typename = flag.String("type", "", "type to generate methods for")
)
flag.Parse()
Expand All @@ -46,7 +45,7 @@ func main() {
GenerateEncoder: *genEncoder,
GenerateDecoder: *genDecoder,
}
code, err := cfg.process(*norlpGen)
code, err := cfg.process()
if err != nil {
fatal(err)
}
Expand All @@ -71,17 +70,13 @@ type Config struct {
}

// process generates the Go code.
func (cfg *Config) process(norlpGen bool) (code []byte, err error) {
func (cfg *Config) process() (code []byte, err error) {
// Load packages.
pcfg := &packages.Config{
Mode: packages.NeedName | packages.NeedTypes | packages.NeedImports | packages.NeedDeps,
Mode: packages.NeedName | packages.NeedTypes,
Dir: cfg.Dir,
}

if norlpGen {
pcfg.BuildFlags = []string{"-tags", "norlpgen"}
}

ps, err := packages.Load(pcfg, pathOfPackageRLP, ".")
if err != nil {
return nil, err
Expand Down Expand Up @@ -122,8 +117,8 @@ func (cfg *Config) process(norlpGen bool) (code []byte, err error) {
// This is done here to avoid processing these lines with gofmt.
var header bytes.Buffer
fmt.Fprint(&header, "// Code generated by rlpgen. DO NOT EDIT.\n\n")
fmt.Fprint(&header, "//go:build !norlpgen\n")
fmt.Fprint(&header, "// +build !norlpgen\n\n")
//fmt.Fprint(&header, "//go:build !norlpgen\n")
//fmt.Fprint(&header, "// +build !norlpgen\n\n")
return append(header.Bytes(), code...), nil
}

Expand Down
Loading