Files
node-problem-detector/vendor/github.com/modern-go/reflect2/safe_struct.go
Xuewei Zhang 3fc6c7f306 Add vendor code for Boskos
Added replace statement for apache/thrift, since it has been recently
moved from git.apache.org/thrift.git to github.com/apache/thrift, and is
causing `go get` to fail.

See https://github.com/jenkins-x/jx/pull/3321 for more detail.

Commands used:
GO111MODULE=on go get k8s.io/test-infra/boskos/client
GO111MODULE=on go mod vendor
2019-09-14 15:22:09 -07:00

30 lines
781 B
Go

package reflect2
type safeStructType struct {
safeType
}
func (type2 *safeStructType) FieldByName(name string) StructField {
field, found := type2.Type.FieldByName(name)
if !found {
panic("field " + name + " not found")
}
return &safeField{StructField: field}
}
func (type2 *safeStructType) Field(i int) StructField {
return &safeField{StructField: type2.Type.Field(i)}
}
func (type2 *safeStructType) FieldByIndex(index []int) StructField {
return &safeField{StructField: type2.Type.FieldByIndex(index)}
}
func (type2 *safeStructType) FieldByNameFunc(match func(string) bool) StructField {
field, found := type2.Type.FieldByNameFunc(match)
if !found {
panic("field match condition not found in " + type2.Type.String())
}
return &safeField{StructField: field}
}