From 78d356b26f82e7d1c26111d07024778ae2055e1c Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Fri, 11 Mar 2016 17:03:02 +0100 Subject: some minor refactoring diff --git a/rhimport/fetcher.go b/rhimport/fetcher.go index 9d5280b..a253eb4 100644 --- a/rhimport/fetcher.go +++ b/rhimport/fetcher.go @@ -374,14 +374,14 @@ func fetcherInit() { } } -func checkPassword(ctx *Context, result *Result) (err error) { +func checkPassword(ctx *Context, res *Result) (err error) { ok := false if ok, err = ctx.CheckPassword(); err != nil { return } if !ok { - result.ResponseCode = http.StatusUnauthorized - result.ErrorString = "invalid username and/or password" + res.ResponseCode = http.StatusUnauthorized + res.ErrorString = "invalid username and/or password" } return } diff --git a/rhimport/importer.go b/rhimport/importer.go index 8e58ff6..6d994c3 100644 --- a/rhimport/importer.go +++ b/rhimport/importer.go @@ -36,11 +36,11 @@ import ( "github.com/andelf/go-curl" ) -func (self *Result) fromRDWebResult(rdres *RDWebResult) { - self.ResponseCode = rdres.ResponseCode - self.ErrorString = rdres.ErrorString +func (res *Result) fromRDWebResult(rdres *RDWebResult) { + res.ResponseCode = rdres.ResponseCode + res.ErrorString = rdres.ErrorString if rdres.AudioConvertError != 0 { - self.ErrorString += fmt.Sprintf(", Audio Convert Error: %d", rdres.AudioConvertError) + res.ErrorString += fmt.Sprintf(", Audio Convert Error: %d", rdres.AudioConvertError) } } @@ -507,13 +507,12 @@ func ImportFile(ctx *Context) (res *Result, err error) { rhl.Printf("Fileimport has failed (Cart/Cut %d/%d): %s", res.Cart, res.Cut, res.ErrorString) } // Try to clean up after failed import - rmres := Result{ResponseCode: http.StatusOK} if rmCartOnErr { - if rerr := removeCart(ctx, &rmres); rerr != nil { + if rerr := removeCart(ctx, &Result{ResponseCode: http.StatusOK}); rerr != nil { return } } else if rmCutOnErr { - if rerr := removeCut(ctx, &rmres); rerr != nil { + if rerr := removeCut(ctx, &Result{ResponseCode: http.StatusOK}); rerr != nil { return } } -- cgit v0.10.2