lundi 29 avril 2019

io.Writer /dev/null like object in golang?

I provide io.Writer to server to direct logs (e.g. to file or Stderr).

However, in tests I would like to skip those logs. I wonder, is there io.Writer object that acts like '/dev/null' ?

(Yes, of course I can try to open /dev/null, but for tests and in general I've thought it may be more elegant to make it as object)

Aucun commentaire:

Enregistrer un commentaire