mirror of
https://github.com/vbatts/talks.git
synced 2025-05-24 13:52:30 +00:00
2015-devnation: final changes
This commit is contained in:
parent
1b8e5c7a36
commit
8e251effd9
5 changed files with 152 additions and 8 deletions
27
2015/06-devnation-golang-good-bad-ugly/ugly2.go
Normal file
27
2015/06-devnation-golang-good-bad-ugly/ugly2.go
Normal file
|
@ -0,0 +1,27 @@
|
|||
// +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
|
Loading…
Add table
Add a link
Reference in a new issue