From 32137af301dfa4442b5fd2febd07069a39c77d77 Mon Sep 17 00:00:00 2001 From: Matias Insaurralde Date: Sun, 5 Jun 2016 20:10:17 -0400 Subject: [PATCH] go fmt --- marshalers/brotli.go | 3 +-- marshalers/brotli_test.go | 4 ++-- marshalers/chain.go | 26 +++++++++++++------------- marshalers/chain_test.go | 4 ++-- 4 files changed, 18 insertions(+), 19 deletions(-) diff --git a/marshalers/brotli.go b/marshalers/brotli.go index 60f80fb..50fff7c 100644 --- a/marshalers/brotli.go +++ b/marshalers/brotli.go @@ -47,11 +47,10 @@ func (marshaler BrotliMarshaler) Unmarshal(i *interface{}) (error, interface{}) return err, nil } - var inputBuf []byte inputBuf = (*i).([]byte) - buf, err := dec.DecompressBuffer( inputBuf, make([]byte, 0)) + buf, err := dec.DecompressBuffer(inputBuf, make([]byte, 0)) return err, buf } diff --git a/marshalers/brotli_test.go b/marshalers/brotli_test.go index 23e825a..01f4761 100644 --- a/marshalers/brotli_test.go +++ b/marshalers/brotli_test.go @@ -53,14 +53,14 @@ func TestBrotliUnmarshalChain(t *testing.T) { err, unmarshalOutput := chain.Unmarshal(i) if err != nil { - t.Fatal( err ) + t.Fatal(err) } var protoOutput *transportsProto.HttpRequest protoOutput = unmarshalOutput.(*transportsProto.HttpRequest) if protoOutput.GetUrl() != "http://whatismyip.akamai.com/" { - t.Fatal( "Protobuffer field doesn't have the original HttpRequest value") + t.Fatal("Protobuffer field doesn't have the original HttpRequest value") } } diff --git a/marshalers/chain.go b/marshalers/chain.go index 358e856..2730408 100644 --- a/marshalers/chain.go +++ b/marshalers/chain.go @@ -50,19 +50,19 @@ func (s *ChainData) process(reverseOrder bool) (error, interface{}) { log.Println("--> Chain step #", i) if output == nil { log.Println("No previous output, starting chain") - if reverseOrder { - err, output = m.Unmarshal(&s.input) - } else { - err, output = m.Marshal(&s.input) - } + if reverseOrder { + err, output = m.Unmarshal(&s.input) + } else { + err, output = m.Marshal(&s.input) + } log.Println("First output:", output, "Error:", err) } else { log.Println("Previous output", output) - if reverseOrder { - err, output = m.Unmarshal(&output) - } else { - err, output = m.Marshal(&output) - } + if reverseOrder { + err, output = m.Unmarshal(&output) + } else { + err, output = m.Marshal(&output) + } log.Println("New output:", output, "Error:", err) } @@ -72,9 +72,9 @@ func (s *ChainData) process(reverseOrder bool) (error, interface{}) { } - if output == nil { - err = errors.New(ChainNilOutput) - } + if output == nil { + err = errors.New(ChainNilOutput) + } return err, output } diff --git a/marshalers/chain_test.go b/marshalers/chain_test.go index e222711..d9ecef8 100644 --- a/marshalers/chain_test.go +++ b/marshalers/chain_test.go @@ -24,9 +24,9 @@ func init() { func TestBasicChaining(t *testing.T) { err, chain := transports.NewChain( - transports.DummyMarshaler{}, transports.DummyMarshaler{}, - ) + transports.DummyMarshaler{}, + ) if err != nil { t.Fatal(err)