From a71900996f592ffbdab3bf15d019889b1756ca67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20Trma=C4=8D?= Date: Tue, 15 Mar 2022 21:02:33 +0100 Subject: [PATCH] Rename "self" receiver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit > receiver name should be a reflection of its identity; don't use generic names such as "this" or "self" (ST1006) Signed-off-by: Miloslav Trmač --- cmd/skopeo/proxy.go | 2 +- integration/proxy_test.go | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/cmd/skopeo/proxy.go b/cmd/skopeo/proxy.go index 14c14135..8556e7d7 100644 --- a/cmd/skopeo/proxy.go +++ b/cmd/skopeo/proxy.go @@ -98,7 +98,7 @@ const maxMsgSize = 32 * 1024 // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER // We hard error if the input JSON numbers we expect to be // integers are above this. -const maxJSONFloat = float64(1<<53 - 1) +const maxJSONFloat = float64(uint64(1)<<53 - 1) // request is the JSON serialization of a function call type request struct { diff --git a/integration/proxy_test.go b/integration/proxy_test.go index 490277a8..69a3a290 100644 --- a/integration/proxy_test.go +++ b/integration/proxy_test.go @@ -57,7 +57,7 @@ type pipefd struct { fd *os.File } -func (self *proxy) call(method string, args []interface{}) (rval interface{}, fd *pipefd, err error) { +func (p *proxy) call(method string, args []interface{}) (rval interface{}, fd *pipefd, err error) { req := request{ Method: method, Args: args, @@ -66,7 +66,7 @@ func (self *proxy) call(method string, args []interface{}) (rval interface{}, fd if err != nil { return } - n, err := self.c.Write(reqbuf) + n, err := p.c.Write(reqbuf) if err != nil { return } @@ -76,7 +76,7 @@ func (self *proxy) call(method string, args []interface{}) (rval interface{}, fd } oob := make([]byte, syscall.CmsgSpace(1)) replybuf := make([]byte, maxMsgSize) - n, oobn, _, _, err := self.c.ReadMsgUnix(replybuf, oob) + n, oobn, _, _, err := p.c.ReadMsgUnix(replybuf, oob) if err != nil { err = fmt.Errorf("reading reply: %v", err) return @@ -119,9 +119,9 @@ func (self *proxy) call(method string, args []interface{}) (rval interface{}, fd return } -func (self *proxy) callNoFd(method string, args []interface{}) (rval interface{}, err error) { +func (p *proxy) callNoFd(method string, args []interface{}) (rval interface{}, err error) { var fd *pipefd - rval, fd, err = self.call(method, args) + rval, fd, err = p.call(method, args) if err != nil { return } @@ -132,9 +132,9 @@ func (self *proxy) callNoFd(method string, args []interface{}) (rval interface{} return rval, nil } -func (self *proxy) callReadAllBytes(method string, args []interface{}) (rval interface{}, buf []byte, err error) { +func (p *proxy) callReadAllBytes(method string, args []interface{}) (rval interface{}, buf []byte, err error) { var fd *pipefd - rval, fd, err = self.call(method, args) + rval, fd, err = p.call(method, args) if err != nil { return } @@ -150,7 +150,7 @@ func (self *proxy) callReadAllBytes(method string, args []interface{}) (rval int err: err, } }() - _, err = self.callNoFd("FinishPipe", []interface{}{fd.id}) + _, err = p.callNoFd("FinishPipe", []interface{}{fd.id}) if err != nil { return }