var _ xerrors.Formatter =包装{} [重复]

This question already has an answer here:

https://github.com/golang/xerrors/blob/master/fmt_test.go#L379

var _ xerrors.Formatter = wrapped{}

var _ xerrors.Formatter = detailed{}

What is the purpose of this two lines?

</div>

https://github.com/golang/xerrors

This repository holds the transition packages for the new Go 1.13 error values.


Look at the Go source tip for the actual implementation for Go1.13.

https://go.googlesource.com/go


Compile time checks that they satisfy xerrors.Formatter.

var _ xerrors.Formatter = wrapped{}

var _ xerrors.Formatter = detailed{}