Description
Proposal Details
#66408 has been accepted and will add a new struct package in the standard library.
There are few other marker types we should consider to add to this structs package: namely
package structs
type NoUnkeyedLiterals struct{}
type DoNotImplement interface{
DoNotImplementInternal(DoNotImplement)
}
type DoNotCompare [0]func()
type DoNotCopy [0]sync.Mutex
These are actually pretty common since the Go protobuf code uses this kind of pseudo directives: https://github.com/protocolbuffers/protobuf-go/blob/master/internal/pragma/pragma.go
The Go protobuf generator includes these in all types generated so they should make up a significant part of the Go corpus.
Furthermore as shown in #67196 currently the lack of these marker types lessens the readability of Go code. There are likely many Go projects that could use these marker types.So I think they will pass the bar of being common enough to be included in the standard library. Adding them to the standard library also allows to improve go vet detection in the case of DoNotCopy.
So please consider adding them.
Metadata
Metadata
Assignees
Type
Projects
Status