hashicorp / go-getter

Package for downloading things from a string URL using a variety of protocols.
Mozilla Public License 2.0
1.62k stars 226 forks source link

get_gcs.getObject is not handling error gracefully #445

Open avinash84 opened 1 year ago

avinash84 commented 1 year ago

At line, rc, err = client.Bucket(bucket).Object(object).Generation(generation).NewReader(ctx)

error is received but is limited to enclosing block and is not available outside the block where the error is handled at line

    if err != nil {
        return err
    }

This results in a crash further, something like panic: runtime error: invalid memory address or nil pointer dereference

Line generation, err := strconv.ParseInt(fragment, 10, 64) might be causing the scope of err to get limited to the enclosing block.