diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 6f5e46cd3..91c50dc28 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -1,55 +1,19 @@ -# This workflow will build a golang project -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go - name: Go - -on: - push: - branches: ["main"] - pull_request: - branches: ["main"] +on: [push] jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - name: Set up Go - uses: actions/setup-go@v3 - with: - go-version: 1.19 - - - name: Golangci - uses: golangci/golangci-lint-action@v3 - with: - # Require: The version of golangci-lint to use. - # When `install-mode` is `binary` (default) the value can be v1.2 or v1.2.3 or `latest` to use the latest version. - # When `install-mode` is `goinstall` the value can be v1.2.3, `latest`, or the hash of a commit. - version: latest - - # Optional: working directory, useful for monorepos - # working-directory: somedir - - # Optional: golangci-lint command line arguments. - # - # Note: By default, the `.golangci.yml` file should be at the root of the repository. - # The location of the configuration file can be changed by using `--config=` - # args: --timeout=30m --config=/my/path/.golangci.yml --issues-exit-code=0 - - args: --timeout 3m --verbose - # Optional: show only new issues if it's a pull request. The default value is `false`. - only-new-issues: true - - # Optional: if set to true, then all caching functionality will be completely disabled, - # takes precedence over all other caching options. - # skip-cache: true - - # Optional: if set to true, then the action won't cache or restore ~/go/pkg. - # skip-pkg-cache: true - - # Optional: if set to true, then the action won't cache or restore ~/.cache/go-build. - # skip-build-cache: true - - # Optional: The mode to install golangci-lint. It can be 'binary' or 'goinstall'. - # install-mode: "goinstall" + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Setup Go + uses: actions/setup-go@v4 + with: + go-version: '1.19' + - name: Install dependencies + run: go get . + - name: Build + run: go build -v ./... + - name: Test with the Go CLI + run: go test \ No newline at end of file diff --git a/shared/services/beacon/client/std-http-client.go b/shared/services/beacon/client/std-http-client.go index a1abda1df..27e10a245 100644 --- a/shared/services/beacon/client/std-http-client.go +++ b/shared/services/beacon/client/std-http-client.go @@ -592,10 +592,12 @@ func (c *StandardHttpClient) getNodeVersion() (NodeVersionResponse, error) { if status != http.StatusOK { return NodeVersionResponse{}, fmt.Errorf("Could not get node sync status: HTTP status %d; response body: '%s'", status, string(responseBody)) } + var nodeVersion NodeVersionResponse if err := json.Unmarshal(responseBody, &nodeVersion); err != nil { return NodeVersionResponse{}, fmt.Errorf("Could not decode node sync status: %w", err) } + return nodeVersion, nil } diff --git a/shared/services/gas/gas.go b/shared/services/gas/gas.go index c1ffa08cf..53c5fc228 100644 --- a/shared/services/gas/gas.go +++ b/shared/services/gas/gas.go @@ -184,7 +184,7 @@ func handleEtherscanGasPrices(gasSuggestion etherscan.GasFeeSuggestion, priority desiredPriceFloat, err := strconv.ParseFloat(desiredPrice, 64) if err != nil { - fmt.Println("Not a valid gas price (%s), try again.", err.Error()) + fmt.Printf("Not a valid gas price (%s), try again.\n", err.Error()) continue } if desiredPriceFloat <= 0 { diff --git a/shared/services/requirements.go b/shared/services/requirements.go index 2e4bdaf34..9e5a157dc 100644 --- a/shared/services/requirements.go +++ b/shared/services/requirements.go @@ -499,7 +499,7 @@ func waitBeaconClientSynced(c *cli.Context, verbose bool, timeout int64) (bool, // Check sync status if syncStatus.Syncing { if verbose { - log.Println("Eth 2.0 node syncing: %.2f%%\n", syncStatus.Progress*100) + log.Println("Eth 2.0 node syncing: %.2f%%", syncStatus.Progress*100) } } else { return true, nil diff --git a/shared/services/stader/client.go b/shared/services/stader/client.go index 6f361c0e5..407016bc3 100644 --- a/shared/services/stader/client.go +++ b/shared/services/stader/client.go @@ -298,7 +298,7 @@ func (c *Client) UpdatePrometheusConfiguration(settings map[string]string) error } err = os.Chmod(prometheusConfigPath, 0664) if err != nil { - return fmt.Errorf("Could not set Prometheus config file permissions: %w", shellescape.Quote(prometheusConfigPath), err) + return fmt.Errorf("Could not set Prometheus config file permissions: %s, %w", shellescape.Quote(prometheusConfigPath), err) } return nil diff --git a/stader-cli/node/claim-sp-rewards.go b/stader-cli/node/claim-sp-rewards.go index 53623f240..573fedf74 100644 --- a/stader-cli/node/claim-sp-rewards.go +++ b/stader-cli/node/claim-sp-rewards.go @@ -66,7 +66,7 @@ func ClaimSpRewards(c *cli.Context) error { cycleIndexes = append(cycleIndexes, big.NewInt(cycleInfo.MerkleProofInfo.Cycle)) } - fmt.Println("Following are the unclaimed cycles, Please enter in a comma seperated string the cycles you want to claim rewards for:\n") + fmt.Println("Following are the unclaimed cycles, Please enter in a comma separated string the cycles you want to claim rewards for:") fmt.Printf("%-18s%-14.30s%-14.10s%-10s\n", "Cycle Number", "Cycle Date", "ETH Rewards", "SD Rewards") cyclesToClaim := map[int64]bool{} diff --git a/stader-cli/service/service.go b/stader-cli/service/service.go index 8088f1c93..867a56788 100644 --- a/stader-cli/service/service.go +++ b/stader-cli/service/service.go @@ -914,7 +914,7 @@ func pruneExecutionClient(c *cli.Context) error { } fmt.Println("This will shut down your main execution client and prune its database, freeing up disk space.") - fmt.Println("Once pruning is complete, your execution client will restart automatically.\n") + fmt.Println("Once pruning is complete, your execution client will restart automatically.") if selectedEc == cfgtypes.ExecutionClient_Geth { if cfg.UseFallbackClients.Value == false { @@ -1488,7 +1488,7 @@ func exportEcData(c *cli.Context, targetDir string) error { fmt.Println("This will export your execution client's chain data to an external directory, such as a portable hard drive.") fmt.Println("If your execution client is running, it will be shut down.") - fmt.Println("Once the export is complete, your execution client will restart automatically.\n") + fmt.Println("Once the export is complete, your execution client will restart automatically.") // Get the container prefix prefix, err := getContainerPrefix(staderClient) @@ -1606,7 +1606,7 @@ func importEcData(c *cli.Context, sourceDir string) error { fmt.Println("This will import execution layer chain data that you previously exported into your execution client.") fmt.Println("If your execution client is running, it will be shut down.") - fmt.Println("Once the import is complete, your execution client will restart automatically.\n") + fmt.Println("Once the import is complete, your execution client will restart automatically.") // Get the volume to import into executionContainerName := prefix + ExecutionContainerSuffix diff --git a/stader/node/node_test.go b/stader/node/node_test.go index cb806a28c..67bcdfad0 100644 --- a/stader/node/node_test.go +++ b/stader/node/node_test.go @@ -40,7 +40,7 @@ func TestVerifySignature(t *testing.T) { ExecutionClient: ExecutionClient, ConsensusClient: ConsensusClient, ValidatorClient: ValidatorClient, - TotalNonTerminalKeys: 1, + TotalNonTerminalKeys: 10, NodeAddress: crypto.PubkeyToAddress(*publicKeyECDSA).String(), NodePublicKey: hex.EncodeToString(pubkeyBytes), Relays: "ultrasound,aestus",