Skip to content

Commit

Permalink
fix: fixing go generate directive comments and using Sprintf in openr…
Browse files Browse the repository at this point in the history
…pc.go
  • Loading branch information
distractedm1nd committed Nov 23, 2022
1 parent ec4d8cd commit de8f022
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
8 changes: 2 additions & 6 deletions api/docgen/openrpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,8 @@ func ParseCommentsFromNodebuilderModules(moduleNames ...string) Comments {
fset := token.NewFileSet()
nodeComments := make(Comments)
for _, moduleName := range moduleNames {
f, err := parser.ParseFile(
fset,
"nodebuilder/"+moduleName+"/"+moduleName+".go",
nil,
parser.AllErrors|parser.ParseComments,
)
fileName := fmt.Sprintf("nodebuilder/%s/%s.go", moduleName, moduleName)
f, err := parser.ParseFile(fset, fileName, nil, parser.AllErrors|parser.ParseComments)
if err != nil {
panic(err)
}
Expand Down
2 changes: 2 additions & 0 deletions nodebuilder/header/header.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import (

// Module exposes the functionality needed for querying headers from the network.
// Any method signature changed here needs to also be changed in the API struct.
//
//go:generate mockgen -destination=mocks/api.go -package=mocks . Module
type Module interface {
// GetByHeight returns the ExtendedHeader at the given height, blocking
// until header has been processed by the store or context deadline is exceeded.
Expand Down
2 changes: 0 additions & 2 deletions nodebuilder/share/share.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ func NewModule(lc fx.Lifecycle, bServ blockservice.BlockService, avail share.Ava

// API is a wrapper around Module for the RPC.
// TODO(@distractedm1nd): These structs need to be autogenerated.
//
//go:generate go run github.com/golang/mock/mockgen -destination=mocks/api.go -package=mocks . Module
type API struct {
SharesAvailable func(context.Context, *share.Root) error
ProbabilityOfAvailability func() float64
Expand Down

0 comments on commit de8f022

Please sign in to comment.