Golang net/textproto.Writer type, PrintfLine() and NewWriter() functions example
package net/textproto
Golang net/textproto.Writer type, PrintfLine() and NewWriter() functions usage example
package main
import (
"bufio"
"bytes"
"fmt"
"net/textproto"
)
func main() {
var buf bytes.Buffer
writer := textproto.NewWriter(bufio.NewWriter(&buf))
writer.PrintfLine("The test data size is %d bytes", 1234567)
fmt.Println(buf.String())
}
Output :
The test data size is 1234567 bytes
References :
http://golang.org/pkg/net/textproto/#Writer
Advertisement
Something interesting
Tutorials
+7.4k Golang : Scanf function weird error in Windows
+17.6k Golang : Upload/Receive file progress indicator
+19.4k Golang : Fix cannot download, $GOPATH not set error
+6.5k PHP : Shuffle to display different content or advertisement
+10.3k Golang : Wait and sync.WaitGroup example
+9.3k Golang : Generate EAN barcode
+7.2k CloudFlare : Another way to get visitor's real IP address
+22.1k Golang : Join arrays or slices example
+3.6k Java : Get FX sentiment from website example
+10.3k Golang : Embed secret text string into binary(executable) file
+9.9k Golang : Function wrapper that takes arguments and return result example
+14k Golang : Google Drive API upload and rename example