You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
GetCredential() return a iface. Even if its value is nil, no error will be reported here when its type is not nil, which will cause panic in the following process.
The text was updated successfully, but these errors were encountered:
a interface will not be equal to nil even the value it contains is nil.
the following example will output
true true
false true
false false
package main
import (
"io"
)
type Fake struct {
}
func (f *Fake) Write(b []byte) (int, error) {
return 0, nil
}
func main() {
var a io.Writer
var b *Fake
println(a == nil, b == nil)
a = b
println(a == nil, b == nil)
b = &Fake{}
println(a == nil, b == nil)
}
But i think its fine, since it will panic and show you the error stack.
tencentcloud-sdk-go/tencentcloud/sts/v20180813/client.go
Lines 182 to 184 in 60b9839
tencentcloud-sdk-go/tencentcloud/common/client.go
Lines 546 to 548 in 60b9839
tencentcloud-sdk-go/tencentcloud/common/credentials.go
Lines 5 to 12 in 60b9839
GetCredential()
return a iface. Even if itsvalue
is nil, no error will be reported here when itstype
is not nil, which will cause panic in the following process.The text was updated successfully, but these errors were encountered: