Skip to content

Commit

Permalink
chore: fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
simlecode committed Oct 31, 2022
1 parent 285965c commit d180f6a
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ bundle-gen:
cd venus-devtool && go run ./bundle-gen/*.go --dst ./../venus-shared/actors/builtin_actors_gen.go

state-type-gen:
cd venus-devtool && go run ./state-type-gen/*.go --dst ./../venus-shared/types/alias_types_gen.go
cd venus-devtool && go run ./state-type-gen/*.go --dst ./../venus-shared/types/state_types_gen.go

api-gen:
find ./venus-shared/api/ -name 'client_gen.go' -delete
Expand Down
14 changes: 13 additions & 1 deletion venus-devtool/state-type-gen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ var (

func run(cctx *cli.Context) error {
metas := make([]*metaVisitor, 0, len(pendingPkgs))
for _, pkg := range pendingPkgs {
for _, pkg := range toList(pendingPkgs) {
location, err := util.FindPackageLocation(pkg.path)
if err != nil {
return err
Expand Down Expand Up @@ -124,6 +124,18 @@ func run(cctx *cli.Context) error {
return writeFile(cctx.String("dst"), metas)
}

func toList(pkgs map[string]*pendingPkg) []*pendingPkg {
list := make([]*pendingPkg, 0, len(pkgs))
for _, pkg := range pkgs {
list = append(list, pkg)
}
sort.Slice(list, func(i, j int) bool {
return list[i].name < list[j].name
})

return list
}

func filter(fi fs.FileInfo) bool {
if strings.Contains(fi.Name(), "cbor_gen.go") {
return false
Expand Down
16 changes: 8 additions & 8 deletions venus-shared/types/alias_types_gen.go → venus-shared/types/state_types_gen.go
100644 → 100755

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

0 comments on commit d180f6a

Please sign in to comment.