Skip to content

Commit

Permalink
Made goling and go vet happy
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Smith committed Jun 25, 2016
1 parent 5e6433a commit ae58f69
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
3 changes: 2 additions & 1 deletion relay/dynamic_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ func (dcu *DynamicConfigUpdater) Run() error {
return nil
}

// Halt tells the DCU to stop.
func (dcu *DynamicConfigUpdater) Halt() {
dcu.control <- 1
}
Expand All @@ -79,7 +80,7 @@ func (dcu *DynamicConfigUpdater) handleBusEvents(conn bus.Connection, event bus.
func (dcu *DynamicConfigUpdater) dynConfigUpdate(conn bus.Connection, topic string, payload []byte) {
defer dcu.refreshTimer.Reset(dcu.refreshInterval)
var envelope messages.DynamicConfigsResponseEnvelope
decoder := util.NewJsonDecoder(bytes.NewReader(payload))
decoder := util.NewJSONDecoder(bytes.NewReader(payload))
if err := decoder.Decode(&envelope); err != nil {
log.Errorf("Error decoding GetDynamicConfigs result: %s.", err)
}
Expand Down
4 changes: 3 additions & 1 deletion relay/util/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import (
"io"
)

func NewJsonDecoder(reader io.Reader) *json.Decoder {
// NewJSONDecoder creates a new JSON decoder which is configured
// to NOT mangle big integers.
func NewJSONDecoder(reader io.Reader) *json.Decoder {
decoder := json.NewDecoder(reader)
decoder.UseNumber()
return decoder
Expand Down
2 changes: 1 addition & 1 deletion relay/worker/execution.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func ExecutionWorker(queue chan interface{}) {
invoke := ctx.Value("invoke").(*CommandInvocation)
if bufferedReader == nil {
bufferedReader = bufio.NewReader(bytes.NewReader(invoke.Payload))
decoder = util.NewJsonDecoder(bufferedReader)
decoder = util.NewJSONDecoder(bufferedReader)
} else {
bufferedReader.Reset(bytes.NewReader(invoke.Payload))
}
Expand Down
3 changes: 1 addition & 2 deletions relay/worker/output_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package worker

import (
"bytes"
"encoding/json"
"fmt"
log "github.com/Sirupsen/logrus"
"github.com/operable/circuit-driver/api"
Expand Down Expand Up @@ -64,7 +63,7 @@ func parseOutput(result api.ExecResult, err error, resp *messages.ExecutionRespo
jsonBody := interface{}(nil)
remaining := []byte(strings.Join(retained, "\n"))

d := util.NewJsonDecoder(bytes.NewReader(remaining))
d := util.NewJSONDecoder(bytes.NewReader(remaining))
if err := d.Decode(&jsonBody); err != nil {
resp.Status = "error"
resp.StatusMessage = "Command returned invalid JSON."
Expand Down

0 comments on commit ae58f69

Please sign in to comment.