Browse Source

Add PITCHME.md for gitpitch

Gildas Chabot 8 years ago
parent
commit
e4bd1f9cfc
1 changed files with 95 additions and 0 deletions
  1. 95 0
      PITCHME.md

+ 95 - 0
PITCHME.md

@@ -0,0 +1,95 @@
1
+#HSLIDE
2
+
3
+# Go plugins
4
+
5
+Gildas Chabot, leboncoin
6
+
7
+#HSLIDE
8
+
9
+## Demo!
10
+
11
+#HSLIDE
12
+
13
+- Released in 1.8
14
+- Add Go code at runtime
15
+- Works only on linux for now
16
+- Based on C's `dlfcn.h` (dynamic linking) with `cgo`
17
+  - See [`src/plugin/plugin_dlopen.go`](https://tip.golang.org/src/plugin/plugin_dlopen.go)
18
+
19
+#HSLIDE
20
+
21
+## Before
22
+
23
+- Add plugins at compile time (Caddy)
24
+- HTTP/RPC calls
25
+
26
+#HSLIDE
27
+
28
+## Now: Plugin side
29
+
30
+- Nothing special on the code of the plugin
31
+  - `-buildmode=plugin` build option
32
+- Creates a `.so`
33
+
34
+#HSLIDE
35
+
36
+## Now: Caller side
37
+
38
+- Only two functions:
39
+  - `Open(path string) (*Plugin, error)`
40
+  - `(p  *Plugin) Lookup(symName string) (Symbol, error)`
41
+- Two types:
42
+  - `Plugin`
43
+  - `Symbol`
44
+
45
+#HSLIDE
46
+
47
+## Example
48
+
49
+```
50
+p, err := plugin.Open("plugin.so")
51
+
52
+fs, err := p.Lookup("Transform")
53
+f, ok := fs.(func(image.Image) image.Image)
54
+
55
+vs, err := p.Lookup("Priority")
56
+v, ok = *vs.(*int)
57
+```
58
+
59
+#HSLIDE
60
+
61
+## Need?
62
+
63
+- Add ---
64
+
65
+#HSLIDE
66
+
67
+## Safety?
68
+
69
+- Plugin == safe?
70
+- Same rights as caller <!-- .element: class="fragment" -->
71
+- Check the sources of the plugins! <!-- .element: class="fragment" -->
72
+
73
+#HSLIDE
74
+
75
+## Stable?
76
+
77
+- What happens on `panic`?
78
+- --- <!-- .element: class="fragment" -->
79
+
80
+#HSLIDE
81
+
82
+## Go + C?
83
+
84
+- Go plugin used in C
85
+  - Already done with ---  <!-- .element: class="fragment" -->
86
+- C `.so` loaded in Go
87
+  - For now, error --- <!-- .element: class="fragment" -->
88
+
89
+#HSLIDE
90
+
91
+## Thank you
92
+
93
+Questions?
94
+
95
+Find the code and slides on Github: https://github.com/GildasCh/go-plugins-demo