Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
otherview committed Dec 30, 2024
1 parent 0d9199c commit fcc2486
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 10 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ jobs:
with:
go-version: 1.22.x

- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y make git build-essential
- name: Pull Docker Image
run: docker pull vechain/thor:latest

- name: Make Test
id: unit-test
run: go test ./... -count=1
2 changes: 1 addition & 1 deletion cmd/cmd/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ var apiCmd = &cobra.Command{
httpAPI := api.New(envManager, presets)

if err := httpAPI.Start(); err != nil {
slog.Error("Shutting down.. Unexpected error in api - %w", err)
slog.Error("Shutting down.. Unexpected error in api", "err", err)
return
}
slog.Info("Shutting down..")
Expand Down
2 changes: 1 addition & 1 deletion cmd/cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ var configureCmd = &cobra.Command{
// Read from the specified file
data, err := os.ReadFile(args[0])
if err != nil {
slog.Error("Error reading config file: %v\n", err)
slog.Error("Error reading config file", "err", err)
os.Exit(1)
}

Expand Down
3 changes: 2 additions & 1 deletion cmd/cmd/root.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package cmd

import (
"github.com/spf13/cobra"
"os"

"github.com/spf13/cobra"
)

// rootCmd represents the base command when called without any subcommands
Expand Down
2 changes: 1 addition & 1 deletion entrypoint/api/http_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func (s *Server) Start() error {
slog.Info("Server started on :8080")
err := http.ListenAndServe(":8080", nil)
if err != nil {
slog.Error("Error starting server:", err)
slog.Error("Error starting server", "err", err)
}
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion environments/local/local_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package local
import (
"encoding/json"
"fmt"
"github.com/vechain/networkhub/thorbuilder"
"log/slog"
"strings"
"testing"
Expand All @@ -12,6 +11,7 @@ import (
"github.com/stretchr/testify/require"
"github.com/vechain/networkhub/network"
"github.com/vechain/networkhub/preset"
"github.com/vechain/networkhub/thorbuilder"
"github.com/vechain/networkhub/utils/client"
"github.com/vechain/networkhub/utils/datagen"
)
Expand Down
3 changes: 1 addition & 2 deletions network/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ func UnmarshalNode(data []byte) (node.Node, error) {
return nil, err
}

var nodeType node.Node
nodeType = &node.BaseNode{}
nodeType := &node.BaseNode{}
if genesisData, ok := raw["genesis"].(map[string]interface{}); ok {
if forkConfig, ok := genesisData["forkConfig"].(map[string]interface{}); ok {
// Handle AdditionalFields
Expand Down
1 change: 1 addition & 0 deletions network/node/genesis/custom_genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package genesis

import (
"fmt"

"github.com/vechain/thor/v2/genesis"
"github.com/vechain/thor/v2/thor"
)
Expand Down
2 changes: 1 addition & 1 deletion network/node/node_base.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ package node

import (
"fmt"
"github.com/vechain/networkhub/network/node/genesis"
"strings"

"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/p2p/discover"
"github.com/vechain/networkhub/network/node/genesis"
)

type BaseNode struct {
Expand Down
2 changes: 0 additions & 2 deletions thorbuilder/thorbuilder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,7 @@ func TestBuilder(t *testing.T) {
require.NoError(t, err)
assert.Equal(t, filepath.Join(builder.downloadPath, "bin", "thor"), thorBinaryPath)
})
}

func TestErrorHandling(t *testing.T) {
t.Run("Invalid Branch", func(t *testing.T) {
branch := "invalid-branch"
builder := New(branch, false)
Expand Down

0 comments on commit fcc2486

Please sign in to comment.