diff --git a/probe/main.go b/probe/main.go index 03e728628..2d92f2cd5 100644 --- a/probe/main.go +++ b/probe/main.go @@ -90,8 +90,8 @@ func main() { } log.Printf("publishing to: %s", strings.Join(targets, ", ")) - factory := func(endpoint, hostname string) (string, xfer.Publisher, error) { - id, publisher, err := xfer.NewHTTPPublisher(endpoint, hostname, *token, probeID, *insecure) + factory := func(hostname, endpoint string) (string, xfer.Publisher, error) { + id, publisher, err := xfer.NewHTTPPublisher(hostname, endpoint, *token, probeID, *insecure) if err != nil { return "", nil, err } diff --git a/xfer/http_publisher.go b/xfer/http_publisher.go index dbe9a1ad6..6accfd7ae 100644 --- a/xfer/http_publisher.go +++ b/xfer/http_publisher.go @@ -47,7 +47,7 @@ func getHTTPTransport(hostname string, insecure bool) (*http.Transport, error) { } // NewHTTPPublisher returns an HTTPPublisher ready for use. -func NewHTTPPublisher(target, hostname, token, probeID string, insecure bool) (string, *HTTPPublisher, error) { +func NewHTTPPublisher(hostname, target, token, probeID string, insecure bool) (string, *HTTPPublisher, error) { httpTransport, err := getHTTPTransport(hostname, insecure) if err != nil { return "", nil, err diff --git a/xfer/http_publisher_test.go b/xfer/http_publisher_test.go index 9421a3398..5f3d123d7 100644 --- a/xfer/http_publisher_test.go +++ b/xfer/http_publisher_test.go @@ -72,7 +72,7 @@ func TestHTTPPublisher(t *testing.T) { if err != nil { t.Fatal(err) } - _, p, err := xfer.NewHTTPPublisher(s.URL, u.Host, token, id, false) + _, p, err := xfer.NewHTTPPublisher(u.Host, s.URL, token, id, false) if err != nil { t.Fatal(err) } diff --git a/xfer/multi_publisher.go b/xfer/multi_publisher.go index a1349d834..dbd666b86 100644 --- a/xfer/multi_publisher.go +++ b/xfer/multi_publisher.go @@ -14,13 +14,13 @@ import ( // targets. See documentation of each method to understand the semantics. type MultiPublisher struct { mtx sync.Mutex - factory func(endpoint, hostname string) (string, Publisher, error) + factory func(hostname, endpoint string) (string, Publisher, error) sema semaphore list []tuple } // NewMultiPublisher returns a new MultiPublisher ready for use. -func NewMultiPublisher(factory func(endpoint, hostname string) (string, Publisher, error)) *MultiPublisher { +func NewMultiPublisher(factory func(hostname, endpoint string) (string, Publisher, error)) *MultiPublisher { return &MultiPublisher{ factory: factory, sema: newSemaphore(maxConcurrentGET), @@ -49,7 +49,7 @@ func (p *MultiPublisher) Set(target string, endpoints []string) { go func(endpoint string) { p.sema.p() defer p.sema.v() - id, publisher, err := p.factory(endpoint, target) + id, publisher, err := p.factory(target, endpoint) c <- tuple{publisher, target, endpoint, id, err} }(endpoint) } diff --git a/xfer/multi_publisher_test.go b/xfer/multi_publisher_test.go index 1b532a821..d25123b06 100644 --- a/xfer/multi_publisher_test.go +++ b/xfer/multi_publisher_test.go @@ -19,7 +19,7 @@ func TestMultiPublisher(t *testing.T) { sum := func() int { return a1.count + a2.count + b2.count + b3.count } - mp := xfer.NewMultiPublisher(func(endpoint, hostname string) (string, xfer.Publisher, error) { + mp := xfer.NewMultiPublisher(func(hostname, endpoint string) (string, xfer.Publisher, error) { switch endpoint { case "a1": return "1", a1, nil