Skip to content

Commit

Permalink
revive: Fix go vet reported warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
hjpotter92 committed Aug 24, 2023
1 parent 55ed746 commit b7b6003
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion cmd/devtool/devtool.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ func main() {
}
createRunScript(devtool.EthController, dataDir, serviceHost, cfg)
if !isBroadcaster {
cliPort += 1
cliPort++
tDataDir := filepath.Join(*baseDataDir, "transcoder_"+acc)
err = os.MkdirAll(tDataDir, 0755)
if err != nil {
Expand Down
3 changes: 2 additions & 1 deletion cmd/devtool/devtool/devtool_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,8 @@ func (d *Devtool) RegisterOrchestrator(cfg DevtoolConfig) error {

tx, err = d.Client.Transcoder(eth.FromPerc(10), eth.FromPerc(5))
if err == eth.ErrCurrentRoundLocked {
// wait for next round and retry
// TODO: wait for next round and retry
fmt.Println("unimplemented: wait for next round and retry")
}
if err != nil {
glog.Error(err)
Expand Down
4 changes: 2 additions & 2 deletions cmd/livepeer/livepeer.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func main() {
flag.CommandLine.SetOutput(os.Stdout)

// Help & Log
mistJson := flag.Bool("j", false, "Print application info as json")
mistJSON := flag.Bool("j", false, "Print application info as json")
version := flag.Bool("version", false, "Print out the version")
verbosity := flag.String("v", "3", "Log verbosity. {4|5|6}")

Expand All @@ -53,7 +53,7 @@ func main() {

vFlag.Value.Set(*verbosity)

if *mistJson {
if *mistJSON {
mistconnector.PrintMistConfigJson(
"livepeer",
"Official implementation of the Livepeer video processing protocol. Can play all roles in the network.",
Expand Down
20 changes: 10 additions & 10 deletions cmd/livepeer/starter/starter.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ var (
smTTL = 60 // 1 minute
)

const RtmpPort = "1935"
const RpcPort = "8935"
const RTMPPort = "1935"
const RPCPort = "8935"
const CliPort = "7935"

type LivepeerConfig struct {
Expand Down Expand Up @@ -134,7 +134,7 @@ type LivepeerConfig struct {
func DefaultLivepeerConfig() LivepeerConfig {
// Network & Addresses:
defaultNetwork := "offchain"
defaultRtmpAddr := "127.0.0.1:" + RtmpPort
defaultRtmpAddr := "127.0.0.1:" + RTMPPort
defaultCliAddr := "127.0.0.1:" + CliPort
defaultHttpAddr := ""
defaultServiceAddr := ""
Expand Down Expand Up @@ -769,7 +769,7 @@ func StartLivepeer(ctx context.Context, cfg LivepeerConfig) {

var sm pm.SenderMonitor
if *cfg.RedeemerAddr != "" {
*cfg.RedeemerAddr = defaultAddr(*cfg.RedeemerAddr, "127.0.0.1", RpcPort)
*cfg.RedeemerAddr = defaultAddr(*cfg.RedeemerAddr, "127.0.0.1", RPCPort)
rc, err := server.NewRedeemerClient(*cfg.RedeemerAddr, senderWatcher, timeWatcher)
if err != nil {
glog.Error("Unable to start redeemer client: ", err)
Expand Down Expand Up @@ -865,7 +865,7 @@ func StartLivepeer(ctx context.Context, cfg LivepeerConfig) {
return
}

*cfg.HttpAddr = defaultAddr(*cfg.HttpAddr, "127.0.0.1", RpcPort)
*cfg.HttpAddr = defaultAddr(*cfg.HttpAddr, "127.0.0.1", RPCPort)
url, err := url.ParseRequestURI("https://" + *cfg.HttpAddr)
if err != nil {
glog.Error("Could not parse redeemer URI: ", err)
Expand Down Expand Up @@ -1008,8 +1008,8 @@ func StartLivepeer(ctx context.Context, cfg LivepeerConfig) {
if n.NodeType == core.BroadcasterNode {
// default lpms listener for broadcaster; same as default rpc port
// TODO provide an option to disable this?
*cfg.RtmpAddr = defaultAddr(*cfg.RtmpAddr, "127.0.0.1", RtmpPort)
*cfg.HttpAddr = defaultAddr(*cfg.HttpAddr, "127.0.0.1", RpcPort)
*cfg.RtmpAddr = defaultAddr(*cfg.RtmpAddr, "127.0.0.1", RTMPPort)
*cfg.HttpAddr = defaultAddr(*cfg.HttpAddr, "127.0.0.1", RPCPort)

bcast := core.NewBroadcaster(n)

Expand Down Expand Up @@ -1244,7 +1244,7 @@ func parseOrchAddrs(addrs string) []*url.URL {
if len(addrs) > 0 {
for _, addr := range strings.Split(addrs, ",") {
addr = strings.TrimSpace(addr)
addr = defaultAddr(addr, "127.0.0.1", RpcPort)
addr = defaultAddr(addr, "127.0.0.1", RPCPort)
if !strings.HasPrefix(addr, "http") {
addr = "https://" + addr
}
Expand Down Expand Up @@ -1320,7 +1320,7 @@ func getServiceURI(n *core.LivepeerNode, serviceAddr string) (*url.URL, error) {
glog.Errorf("Could not look up public IP err=%q", err)
return nil, err
}
addr := "https://" + strings.TrimSpace(string(body)) + ":" + RpcPort
addr := "https://" + strings.TrimSpace(string(body)) + ":" + RPCPort
inferredUri, err := url.ParseRequestURI(addr)
if err != nil {
glog.Errorf("Could not look up public IP err=%q", err)
Expand All @@ -1340,7 +1340,7 @@ func getServiceURI(n *core.LivepeerNode, serviceAddr string) (*url.URL, error) {
ethUri, err := url.ParseRequestURI(addr)
if err != nil {
glog.Errorf("Could not parse service URI; orchestrator may be unreachable err=%q", err)
ethUri, _ = url.ParseRequestURI("http://127.0.0.1:" + RpcPort)
ethUri, _ = url.ParseRequestURI("http://127.0.0.1:" + RPCPort)
}
if ethUri.Hostname() != inferredUri.Hostname() || ethUri.Port() != inferredUri.Port() {
glog.Errorf("Service address %v did not match discovered address %v; set the correct address in livepeer_cli or use -serviceAddr", ethUri, inferredUri)
Expand Down
2 changes: 1 addition & 1 deletion cmd/livepeer_cli/wizard_bond.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func (w *wizard) getRegisteredOrchestrators() ([]lpTypes.Transcoder, error) {
}

if resp.StatusCode != http.StatusOK {
return nil, errors.New(fmt.Sprintf("http error: %d", resp.StatusCode))
return nil, fmt.Errorf("http error: %d", resp.StatusCode)
}

defer resp.Body.Close()
Expand Down
3 changes: 1 addition & 2 deletions cmd/livepeer_cli/wizard_rounds.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package main

import (
"errors"
"fmt"
"io/ioutil"
"math/big"
Expand All @@ -17,7 +16,7 @@ func (w *wizard) currentRound() (*big.Int, error) {
defer resp.Body.Close()

if resp.StatusCode != http.StatusOK {
return nil, errors.New(fmt.Sprintf("http response status %d", resp.StatusCode))
return nil, fmt.Errorf("http response status %d", resp.StatusCode)
}

body, err := ioutil.ReadAll(resp.Body)
Expand Down
6 changes: 3 additions & 3 deletions cmd/livepeer_cli/wizard_stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ func (w *wizard) getProtocolParameters() (lpTypes.ProtocolParameters, error) {
}

if resp.StatusCode != http.StatusOK {
return lpTypes.ProtocolParameters{}, errors.New(fmt.Sprintf("http error: %d", resp.StatusCode))
return lpTypes.ProtocolParameters{}, fmt.Errorf("http error: %d", resp.StatusCode)
}

defer resp.Body.Close()
Expand All @@ -328,7 +328,7 @@ func (w *wizard) getContractAddresses() (map[string]common.Address, error) {
}

if resp.StatusCode != http.StatusOK {
return nil, errors.New(fmt.Sprintf("http error: %d", resp.StatusCode))
return nil, fmt.Errorf("http error: %d", resp.StatusCode)
}

defer resp.Body.Close()
Expand Down Expand Up @@ -465,7 +465,7 @@ func (w *wizard) currentBlock() (*big.Int, error) {
defer resp.Body.Close()

if resp.StatusCode != http.StatusOK {
return nil, errors.New(fmt.Sprintf("http response status %d", resp.StatusCode))
return nil, fmt.Errorf("http response status %d", resp.StatusCode)
}

body, err := ioutil.ReadAll(resp.Body)
Expand Down

0 comments on commit b7b6003

Please sign in to comment.