Source File
string.go
Belonging Package
go.uber.org/mock/gomock
package gomock
import (
)
// getString is a safe way to convert a value to a string for printing results
// If the value is a a mock, getString avoids calling the mocked String() method,
// which avoids potential deadlocks
func ( any) string {
if isGeneratedMock() {
return fmt.Sprintf("%T", )
}
if , := .(fmt.Stringer); {
return .String()
}
return fmt.Sprintf("%v", )
}
// isGeneratedMock checks if the given type has a "isgomock" field,
// indicating it is a generated mock.
func ( any) bool {
:= reflect.TypeOf()
if == nil {
return false
}
if .Kind() == reflect.Ptr {
= .Elem()
}
if .Kind() != reflect.Struct {
return false
}
, := .FieldByName("isgomock")
return
}
The pages are generated with Golds v0.7.6. (GOOS=linux GOARCH=amd64)