Standard library / io
io.Discard
Writer that accepts and discards all bytes; useful as a sink when content is not needed. Expected stdout: '3 <nil>\n'.
Formal Syntax & Structure
go syntaxgo
var Discard WriterWorking Example
Example Snippetgo
package main
import ( "fmt" "io")
func main() { n, e := io.WriteString(io.Discard, "abc"); fmt.Println(n, e) }