From 689cda17403ba752305f469fdcc385b7a31b0bdb Mon Sep 17 00:00:00 2001 From: Noah Campbell Date: Tue, 1 Oct 2013 19:59:35 -0700 Subject: [PATCH] Code cleanup --- target/memory.go | 3 +-- transform/chain.go | 4 ++-- transform/chain_test.go | 2 +- transform/posttrans_test.go | 12 ++++++------ 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/target/memory.go b/target/memory.go index f8a3d91e..77437c16 100644 --- a/target/memory.go +++ b/target/memory.go @@ -1,8 +1,8 @@ package target import ( - "io" "bytes" + "io" ) type InMemoryTarget struct { @@ -22,4 +22,3 @@ func (t *InMemoryTarget) Publish(label string, reader io.Reader) (err error) { func (t *InMemoryTarget) Translate(label string) (dest string, err error) { return label, nil } - diff --git a/transform/chain.go b/transform/chain.go index b9a865fe..1d50e8f2 100644 --- a/transform/chain.go +++ b/transform/chain.go @@ -1,8 +1,8 @@ package transform import ( - "io" "bytes" + "io" ) type chain struct { @@ -23,7 +23,7 @@ func (c *chain) Apply(w io.Writer, r io.Reader) (err error) { } in = bytes.NewBuffer(out.Bytes()) } - + _, err = io.Copy(w, in) return } diff --git a/transform/chain_test.go b/transform/chain_test.go index d122c31f..c7105cda 100644 --- a/transform/chain_test.go +++ b/transform/chain_test.go @@ -23,7 +23,7 @@ const H5_JS_CONTENT_ABS_URL_WITH_NAV = "
content foobar. Follow up
" -var two_chain_tests = []test { +var two_chain_tests = []test{ {H5_JS_CONTENT_ABS_URL_WITH_NAV, CORRECT_OUTPUT_SRC_HREF_WITH_NAV}, } diff --git a/transform/posttrans_test.go b/transform/posttrans_test.go index 8ec004e8..fd6bc18b 100644 --- a/transform/posttrans_test.go +++ b/transform/posttrans_test.go @@ -25,15 +25,15 @@ func TestAbsUrlify(t *testing.T) { } type test struct { - content string + content string expected string } -var abs_url_tests = []test { - {H5_JS_CONTENT_DOUBLE_QUOTE, CORRECT_OUTPUT_SRC_HREF}, - {H5_JS_CONTENT_SINGLE_QUOTE, CORRECT_OUTPUT_SRC_HREF}, - {H5_JS_CONTENT_ABS_URL, H5_JS_CONTENT_ABS_URL}, - } +var abs_url_tests = []test{ + {H5_JS_CONTENT_DOUBLE_QUOTE, CORRECT_OUTPUT_SRC_HREF}, + {H5_JS_CONTENT_SINGLE_QUOTE, CORRECT_OUTPUT_SRC_HREF}, + {H5_JS_CONTENT_ABS_URL, H5_JS_CONTENT_ABS_URL}, +} func apply(t *testing.T, tr Transformer, tests []test) { for _, test := range tests { -- 2.30.2