allcloud-io / clisso

Get temporary credentials for cloud providers from the command line.
Mozilla Public License 2.0
44 stars 15 forks source link

check for nil response. update Readme #379

Closed mmoyle closed 8 months ago

mmoyle commented 8 months ago

Fix for ⠋panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x157bc74]

when an http proxy is set. Or for whatever reason a response is not returned by the http client.

Update README.

CLAassistant commented 8 months ago

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

bitte-ein-bit commented 8 months ago

Hey @mmoyle Thanks for catching and fixing this one. Can you accept the CLA so I can merge this? Thank you!

Also the more go idiomatic approach would be to return an error if the response is nil.

mmoyle commented 8 months ago

Hi @bitte-ein-bit , thanks for the quick reply.

I did agree to the CLA. And force pushed two times. Not sure why it's pending. Screenshot 2024-02-27 at 09 44 33

For my issue the error is returned on line 129.

This is consistent with the documentation for net/http "If the returned error is nil, the Response will contain a non-nil Body which the user is expected to close." https://pkg.go.dev/net/http#Client.Do

coveralls commented 8 months ago

Pull Request Test Coverage Report for Build 8061893863

Details


Totals Coverage Status
Change from base Build 8054055802: 0.2%
Covered Lines: 417
Relevant Lines: 1452

💛 - Coveralls
bitte-ein-bit commented 8 months ago

@mmoyle I've checked the CLA backend and can confirm the signature.