summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorMike Vink <mike1994vink@gmail.com>2023-02-25 17:50:50 +0100
committerMike Vink <mike1994vink@gmail.com>2023-02-25 17:50:50 +0100
commit9dbdf08cb814a32ebb27d200391af83c6f2a7ff5 (patch)
tree6fff3e789cdea402113e8705edb739c26dd973f2 /main.go
parentcc446240fac48c545c522f3d69c5d04a93b63461 (diff)
start scaffolding and boilerplate
Diffstat (limited to 'main.go')
-rw-r--r--main.go36
1 files changed, 36 insertions, 0 deletions
diff --git a/main.go b/main.go
new file mode 100644
index 0000000..79c6e0d
--- /dev/null
+++ b/main.go
@@ -0,0 +1,36 @@
+package main
+
+import "fmt"
+
+type flyer interface {
+ fly() string
+ dive() string
+}
+
+type printer func(s string) string
+
+func (p printer) fly() string {
+ return p("I'm flying!")
+}
+
+func (p printer) dive() string {
+ return p("I'm diving!")
+}
+
+func printAndReturn(s string) string {
+ fmt.Println(s)
+ return s
+}
+
+type bird struct {
+ flyer
+}
+
+func main() {
+ bf := bird{
+ flyer: printer(printAndReturn),
+ }
+ bf.fly()
+
+ bs.fly()
+}