From 73504a01e98ed11499bc9809fb327615a2500e89 Mon Sep 17 00:00:00 2001 From: Ali Abbas Date: Tue, 25 Nov 2014 19:54:30 +0100 Subject: [PATCH 1/2] cleanup unreachable code --- command/agent/dns.go | 1 - command/agent/kvs_endpoint.go | 4 ++-- command/exec.go | 1 - consul/fsm.go | 4 ---- 4 files changed, 2 insertions(+), 8 deletions(-) diff --git a/command/agent/dns.go b/command/agent/dns.go index 4244f63f8..43ea245df 100644 --- a/command/agent/dns.go +++ b/command/agent/dns.go @@ -139,7 +139,6 @@ func NewDNSServer(agent *Agent, config *DNSConfig, logOutput io.Writer, domain s case <-time.After(time.Second): return srv, fmt.Errorf("timeout setting up DNS server") } - return srv, nil } // recursorAddr is used to add a port to the recursor if omitted. diff --git a/command/agent/kvs_endpoint.go b/command/agent/kvs_endpoint.go index 48d9ce19d..ffed10f9c 100644 --- a/command/agent/kvs_endpoint.go +++ b/command/agent/kvs_endpoint.go @@ -3,11 +3,12 @@ package agent import ( "bytes" "fmt" - "github.com/hashicorp/consul/consul/structs" "io" "net/http" "strconv" "strings" + + "github.com/hashicorp/consul/consul/structs" ) const ( @@ -50,7 +51,6 @@ func (s *HTTPServer) KVSEndpoint(resp http.ResponseWriter, req *http.Request) (i resp.WriteHeader(405) return nil, nil } - return nil, nil } // KVSGet handles a GET request diff --git a/command/exec.go b/command/exec.go index 996bbd5b2..8e266f4a3 100644 --- a/command/exec.go +++ b/command/exec.go @@ -384,7 +384,6 @@ func (c *ExecCommand) streamResults(doneCh chan struct{}, ackCh chan rExecAck, h } } } - return ERR_EXIT: select { diff --git a/consul/fsm.go b/consul/fsm.go index 2ce6719a4..a6b7c3bb5 100644 --- a/consul/fsm.go +++ b/consul/fsm.go @@ -167,7 +167,6 @@ func (c *consulFSM) applyKVSOperation(buf []byte, index uint64) interface{} { c.logger.Printf("[WARN] consul.fsm: Invalid KVS operation '%s'", req.Op) return fmt.Errorf("Invalid KVS operation '%s'", req.Op) } - return nil } func (c *consulFSM) applySessionOperation(buf []byte, index uint64) interface{} { @@ -188,7 +187,6 @@ func (c *consulFSM) applySessionOperation(buf []byte, index uint64) interface{} c.logger.Printf("[WARN] consul.fsm: Invalid Session operation '%s'", req.Op) return fmt.Errorf("Invalid Session operation '%s'", req.Op) } - return nil } func (c *consulFSM) applyACLOperation(buf []byte, index uint64) interface{} { @@ -211,7 +209,6 @@ func (c *consulFSM) applyACLOperation(buf []byte, index uint64) interface{} { c.logger.Printf("[WARN] consul.fsm: Invalid ACL operation '%s'", req.Op) return fmt.Errorf("Invalid ACL operation '%s'", req.Op) } - return nil } func (c *consulFSM) Snapshot() (raft.FSMSnapshot, error) { @@ -443,7 +440,6 @@ func (s *consulSnapshot) persistKV(sink raft.SnapshotSink, return err } } - return nil } func (s *consulSnapshot) Release() { From ecac719bb8f02b6d39204125b5c4224b4172dd2b Mon Sep 17 00:00:00 2001 From: Ali Abbas Date: Tue, 25 Nov 2014 20:06:33 +0100 Subject: [PATCH 2/2] fix Sprintf formatting --- command/agent/command.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/command/agent/command.go b/command/agent/command.go index 3e1f17bf1..03e92e11e 100644 --- a/command/agent/command.go +++ b/command/agent/command.go @@ -310,7 +310,7 @@ func (c *Command) setupAgent(config *Config, logOutput io.Writer, logWriter *log servers, err := NewHTTPServers(agent, config, logOutput) if err != nil { agent.Shutdown() - c.Ui.Error(fmt.Sprintf("Error starting http servers:", err)) + c.Ui.Error(fmt.Sprintf("Error starting http servers: %s", err)) return err } c.httpServers = servers