From c1cac50095f86624aa7a47df79be4b2a34b118f1 Mon Sep 17 00:00:00 2001 From: blank X Date: Tue, 10 Aug 2021 16:17:44 +0700 Subject: [PATCH] Change capitalisation of PError.{code,message} --- main.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/main.go b/main.go index bb26ebf..35508f7 100644 --- a/main.go +++ b/main.go @@ -147,8 +147,8 @@ func populatePErrors() error { continue } perrors[url.String()] = PError{ - code: gemini.Status(code), - message: unescaper.Replace(values[2]), + Code: gemini.Status(code), + Message: unescaper.Replace(values[2]), } } return nil @@ -175,7 +175,7 @@ func savePErrors() error { if err != nil { return err } - _, err = writer.WriteString(strconv.Itoa(int(perror.code))) + _, err = writer.WriteString(strconv.Itoa(int(perror.Code))) if err != nil { return err } @@ -183,7 +183,7 @@ func savePErrors() error { if err != nil { return err } - _, err = escaper.WriteString(writer, perror.message) + _, err = escaper.WriteString(writer, perror.Message) if err != nil { return err } @@ -223,7 +223,7 @@ func do(client gemini.Client, ctx context.Context, req *gemini.Request, via []*g return do(client, ctx, &redirect, via) } if perror, exists := perrors[req.URL.String()]; exists { - return nil, req, errors.New(fmt.Sprintf("%d %s", perror.code, perror.message)) + return nil, req, errors.New(fmt.Sprintf("%d %s", perror.Code, perror.Message)) } resp, err := client.Do(ctx, req) if err != nil { @@ -247,8 +247,8 @@ func do(client gemini.Client, ctx context.Context, req *gemini.Request, via []*g } if resp.Status.Class() == gemini.StatusPermanentFailure { perrors[req.URL.String()] = PError{ - code: resp.Status, - message: resp.Meta, + Code: resp.Status, + Message: resp.Meta, } err = savePErrors() if err != nil { @@ -399,8 +399,8 @@ func (a ByTime) Swap(i, j int) { } type PError struct { - code gemini.Status - message string + Code gemini.Status + Message string } type AtomWriter struct {