From 4d3aeafa9a22dd1e29371270995f82bc5ddcc5ce Mon Sep 17 00:00:00 2001 From: Christine Dodrill Date: Mon, 3 Dec 2018 17:44:13 -0800 Subject: [PATCH] heh --- ...ces-considered-harmful-2018-12-03.markdown | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/blog/go-interfaces-considered-harmful-2018-12-03.markdown b/blog/go-interfaces-considered-harmful-2018-12-03.markdown index 387046b..d2e7ecb 100644 --- a/blog/go-interfaces-considered-harmful-2018-12-03.markdown +++ b/blog/go-interfaces-considered-harmful-2018-12-03.markdown @@ -110,3 +110,22 @@ All of the men spoke fact about the thing, but none of them spoke the truth of w // after grope switch block log.Printf("%T", thing) // prints Elephant ``` + +--- + +``` + switch thing.(type) { + case Trunker: + log.Printf("man %d: this thing is like a thick snake", id) + case Fanner: + log.Printf("man %d: this thing is like a kind of fan", id) + case TreeTrunker: + log.Printf("man %d: this thing is like a tree trunk", id) + case Waller: + log.Printf("man %d: this thing is like a wall", id) + case Roper: + log.Printf("man %d: this thing is like a rope", id) + case Tusker: + log.Printf("man %d: this thing is hard, smooth and like a spear", id) + } +```