mirror of
https://github.com/vbatts/talks.git
synced 2024-12-27 09:06:30 +00:00
27 lines
327 B
Go
27 lines
327 B
Go
// +build OMIT
|
|
package main
|
|
|
|
import (
|
|
"io"
|
|
"os"
|
|
)
|
|
|
|
// START1 OMIT
|
|
type Message string
|
|
|
|
func (m Message) WriteTo(w io.Writer) (int, error) {
|
|
return w.Write([]byte(m))
|
|
}
|
|
|
|
func (m Message) Reset() {
|
|
m = ""
|
|
}
|
|
|
|
func main() {
|
|
m := Message("Hello World\n")
|
|
m.WriteTo(os.Stdout)
|
|
m.Reset()
|
|
m.WriteTo(os.Stdout)
|
|
}
|
|
|
|
// STOP1 OMIT
|