From 23bc5f4fb7542e64c94eaa7fe2c7a6aa55010898 Mon Sep 17 00:00:00 2001 From: tjpcc Date: Sat, 12 Aug 2023 09:40:39 -0600 Subject: move common types to an internal package This helps avoid import cycles. --- gopher/client.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'gopher/client.go') diff --git a/gopher/client.go b/gopher/client.go index 163d0cd..5ef54ff 100644 --- a/gopher/client.go +++ b/gopher/client.go @@ -7,7 +7,7 @@ import ( "net" neturl "net/url" - sr "tildegit.org/tjp/sliderule" + "tildegit.org/tjp/sliderule/internal/types" ) // Client is used for sending gopher requests and producing the responses. @@ -18,7 +18,7 @@ import ( type Client struct{} // RoundTrip sends a single gopher request and returns its response. -func (c Client) RoundTrip(request *sr.Request) (*sr.Response, error) { +func (c Client) RoundTrip(request *types.Request) (*types.Response, error) { if request.Scheme != "gopher" && request.Scheme != "" { return nil, errors.New("non-gopher protocols not supported") } @@ -52,14 +52,14 @@ func (c Client) RoundTrip(request *sr.Request) (*sr.Response, error) { return nil, err } - return &sr.Response{Body: bytes.NewBuffer(response)}, nil + return &types.Response{Body: bytes.NewBuffer(response)}, nil } // Fetch parses a URL string and fetches the gopher resource. -func (c Client) Fetch(url string) (*sr.Response, error) { +func (c Client) Fetch(url string) (*types.Response, error) { u, err := neturl.Parse(url) if err != nil { return nil, err } - return c.RoundTrip(&sr.Request{URL: u}) + return c.RoundTrip(&types.Request{URL: u}) } -- cgit v1.2.3