startGetObjectRequest will only call newInfo if f.info == nil.
startGetObjectRequest is only called by handleRead.
handleRead is only called to handle a readRequest.
readRequest is only issued in (*s3Reader).Read.
The only way to get an *s3Reader is by (*s3File).Reader. It only does this if f.mode == readonly.
The only way to get a readonly*s3File is by (*s3Impl).Open.
(*s3Impl).Open will only return successfully if the handleStat sends a non-error response, via runRequest and statRequest.
handleStat only sends a non-error response after populating f.info with the result of stat, when stat returns a nil error. stat only returns a nil error when the *s3Info it returns is non-nil.
Therefore, f.info != nil in startGetObjectRequest, and it will not call newInfo.
I think the f.info == nil case became obsolete in 3cf2bd3a402b890b1e04641627c2044fb9fe986e, which introduced the statRequest on (*s3Impl).Open.
startGetObjectRequest
will only callnewInfo
iff.info == nil
.startGetObjectRequest
is only called byhandleRead
.handleRead
is only called to handle areadRequest
.readRequest
is only issued in(*s3Reader).Read
.*s3Reader
is by(*s3File).Reader
. It only does this iff.mode == readonly
.readonly
*s3File
is by(*s3Impl).Open
.(*s3Impl).Open
will only return successfully if thehandleStat
sends a non-errorresponse
, viarunRequest
andstatRequest
.handleStat
only sends a non-error response after populatingf.info
with the result ofstat
, whenstat
returns anil
error.stat
only returns anil
error when the*s3Info
it returns is non-nil.f.info != nil
instartGetObjectRequest
, and it will not callnewInfo
.I think the
f.info == nil
case became obsolete in 3cf2bd3a402b890b1e04641627c2044fb9fe986e, which introduced thestatRequest
on(*s3Impl).Open
.This was raised and originally reasoned about in https://github.com/grailbio/base/pull/16: https://github.com/grailbio/base/pull/16#issuecomment-622092442.