Skip to content

Commit

Permalink
nodes: fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
n8maninger committed Aug 20, 2024
1 parent 93ac69c commit 51c7ee9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion nodes/hostd.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import (
"lukechampine.com/frand"
)

// Hostd starts a new hostd node. It listens on random ports and registers
// StartHostd starts a new hostd node. It listens on random ports and registers
// itself with the Manager. This function blocks until the context is
// canceled. All resources will be cleaned up before the function returns.
func (m *Manager) StartHostd(ctx context.Context, ready chan<- struct{}) error {
Expand Down
17 changes: 9 additions & 8 deletions nodes/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,7 @@ func (m *Manager) Nodes() []Node {
return nodes
}

func createNodeDir(baseDir string, id NodeID) (dir string, err error) {
dir = filepath.Join(baseDir, id.String())
if err := os.MkdirAll(dir, 0700); err != nil {
return "", fmt.Errorf("failed to create node directory: %w", err)
}
return
}

// MineBlocks mines n blocks to the provided reward address.
func (m *Manager) MineBlocks(ctx context.Context, n int, rewardAddress types.Address) error {
log := m.log.Named("mine")

Expand Down Expand Up @@ -140,6 +133,14 @@ func (m *Manager) MineBlocks(ctx context.Context, n int, rewardAddress types.Add
return nil
}

func createNodeDir(baseDir string, id NodeID) (dir string, err error) {
dir = filepath.Join(baseDir, id.String())
if err := os.MkdirAll(dir, 0700); err != nil {
return "", fmt.Errorf("failed to create node directory: %w", err)
}
return
}

// NewManager creates a new node manager.
func NewManager(dir string, cm *chain.Manager, s *syncer.Syncer, log *zap.Logger) *Manager {
return &Manager{
Expand Down
1 change: 1 addition & 0 deletions nodes/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ func (pd ProxyData) MarshalJSON() ([]byte, error) {
return []byte(`"` + str + `"`), nil
}

// ProxyRequest proxies an HTTP request to all nodes matching the filter.
func (m *Manager) ProxyRequest(ctx context.Context, filter, httpMethod, path string, body io.Reader) ([]ProxyResponse, error) {
log := m.log.Named("proxy").With(zap.String("filter", filter), zap.String("method", httpMethod), zap.String("path", path))

Expand Down

0 comments on commit 51c7ee9

Please sign in to comment.