From 3accbaf31dafb85d9d23a71faf71f97751678fb0 Mon Sep 17 00:00:00 2001 From: Andrew Smith Date: Thu, 22 Feb 2018 22:17:59 +0000 Subject: [PATCH] remove unused code --- .travis.yml | 3 ++- loader.go | 4 ---- loader_test.go | 8 -------- merge.go | 9 --------- merge_test.go | 20 -------------------- 5 files changed, 2 insertions(+), 42 deletions(-) diff --git a/.travis.yml b/.travis.yml index da43b21..2ffcc65 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,7 +16,8 @@ script: - test -z "$(gofmt -s -l . 2>&1 | grep -v vendor | tee /dev/stderr)" - golint -set_exit_status ./... - ineffassign ./ - - megacheck -simple.exit-non-zero -unused.exit-non-zero ./ + - megacheck -simple.exit-non-zero=true -staticcheck.exit-non-zero=true -unused.exit-non-zero=true ./ + - megacheck -tests=false -simple.enabled=false -staticcheck.enabled=false -unused.exit-non-zero=true ./ - go test -coverprofile .coverprofile - $GOPATH/bin/goveralls -v -coverprofile .coverprofile -service=travis-ci diff --git a/loader.go b/loader.go index 2beb479..8dcf02e 100644 --- a/loader.go +++ b/loader.go @@ -97,10 +97,6 @@ func containsURL(searchURL *pkgurl.URL, urls []pkgurl.URL) bool { return false } -func newClient() http.Client { - return http.Client{Transport: newTransport()} -} - func newTransport() *http.Transport { transport := &http.Transport{ Proxy: http.ProxyFromEnvironment, diff --git a/loader_test.go b/loader_test.go index b3a720d..2e099f2 100644 --- a/loader_test.go +++ b/loader_test.go @@ -213,14 +213,6 @@ func TestLoadURL_Relative(t *testing.T) { // -------- -func TestNewClient(t *testing.T) { - c := newClient() - assert.NotNil(t, c) - assert.NotNil(t, c.Transport) -} - -// -------- - func TestLoadURLsRecursive_LoadError(t *testing.T) { data, err := loadURLsRecursive(nil, url.URL{}) assert.NotNil(t, err) diff --git a/merge.go b/merge.go index 91e8fea..930d4fe 100644 --- a/merge.go +++ b/merge.go @@ -4,15 +4,6 @@ import ( "reflect" ) -func mergeAll(fromData ...interface{}) (interface{}, error) { - var toData interface{} - err := mergeTo(&toData, fromData...) - if err != nil { - return nil, err - } - return toData, nil -} - func mergeTo(toData interface{}, fromData ...interface{}) error { for _, fromDatum := range fromData { err := merge(toData, fromDatum) diff --git a/merge_test.go b/merge_test.go index 79eb2ac..0f4e32d 100644 --- a/merge_test.go +++ b/merge_test.go @@ -7,26 +7,6 @@ import ( "testing" ) -func TestMergeAll(t *testing.T) { - data1 := map[string]interface{}{"x": 1} - data2 := map[string]interface{}{"y": 1} - data, err := mergeAll(data1, data2) - assert.Nil(t, err) - assert.NotNil(t, data) - m := data.(map[string]interface{}) - assert.NotNil(t, m) - assert.Contains(t, m, "x") - assert.Contains(t, m, "y") -} - -func TestMergeAll_MergeToError(t *testing.T) { - data1 := map[string]interface{}{} - data2 := []interface{}{} - data, err := mergeAll(data1, data2) - assert.NotNil(t, err) - assert.Nil(t, data) -} - func TestMergeTo(t *testing.T) { var toData interface{} data1 := 1