I have a simple structure:
type MyWriter struct {
io.Writer
}
Which I then use in the following way:
writer = MyWriter{io.Stdout}
When running go vet
this gives me a composite literal uses unkeyed fields
.
In order to fix this would I have to turn io.Reader into a field in the MyWriter
structure by adding a key?
type MyWriter struct {
w io.Writer
}
Is there any other way around this? The only other answer I found on here suggests to disable the check altogether but I would rather not do that and find a proper solution.