Open
Description
Proposal Details
A common way to implement union types in Go is with an interface e.g.
type Record struct {
Title string
Value valueType
}
type valueType interface {
isValue()
}
type ValueFoo struct {
Foo string
}
func (ValueFoo) isValue() {}
type ValueBar struct {
Bar string
}
func (ValueBar) isValue() {}
This method is amongst others employed by protobuf. The problem is that these empty functions negatively affect coverage, so in projects where coverage is enforced it can lead to having to write nonsensical tests like this:
func TestValueType(*testing.T) {
tests := []valueType{
ValueFoo{},
ValueBar{},
}
for _, tt := range tests {
tt.isValue()
}
}
To avoid this it would be great if empty functions were excluded from the coverage report.
Metadata
Metadata
Assignees
Type
Projects
Status
Incoming