Browse Source

Updated PITCHME

Gildas Chabot 8 years ago
parent
commit
2bfe62f371
1 changed files with 22 additions and 10 deletions
  1. 22 10
      PITCHME.md

+ 22 - 10
PITCHME.md

@@ -18,11 +18,24 @@ Gildas Chabot, leboncoin
18
 
18
 
19
 #HSLIDE
19
 #HSLIDE
20
 
20
 
21
+## Need?
22
+
23
+- Extend a service with third party functions
24
+  - Web server
25
+  - Media player
26
+- Update behaviour at runtime
27
+
28
+#HSLIDE
29
+
21
 ## Before
30
 ## Before
22
 
31
 
23
 - Add plugins at compile time (Caddy)
32
 - Add plugins at compile time (Caddy)
24
 - HTTP/RPC calls
33
 - HTTP/RPC calls
25
 
34
 
35
+https://github.com/hashicorp/go-plugin
36
+https://github.com/natefinch/pie
37
+
38
+
26
 #HSLIDE
39
 #HSLIDE
27
 
40
 
28
 ## Now: Plugin side
41
 ## Now: Plugin side
@@ -41,6 +54,10 @@ Gildas Chabot, leboncoin
41
 - Two types:
54
 - Two types:
42
   - `Plugin`
55
   - `Plugin`
43
   - `Symbol`
56
   - `Symbol`
57
+- When the plugin if first `Open`, all _new_ packages have their
58
+  `init` function called
59
+
60
+See https://tip.golang.org/pkg/plugin/
44
 
61
 
45
 #HSLIDE
62
 #HSLIDE
46
 
63
 
@@ -58,12 +75,6 @@ v, ok = *vs.(*int)
58
 
75
 
59
 #HSLIDE
76
 #HSLIDE
60
 
77
 
61
-## Need?
62
-
63
-- Add ---
64
-
65
-#HSLIDE
66
-
67
 ## Safety?
78
 ## Safety?
68
 
79
 
69
 - Plugin == safe?
80
 - Plugin == safe?
@@ -74,17 +85,18 @@ v, ok = *vs.(*int)
74
 
85
 
75
 ## Stable?
86
 ## Stable?
76
 
87
 
77
-- What happens on `panic`?
78
-- --- <!-- .element: class="fragment" -->
88
+- Invalid `.so` file
89
+  - `fatal error: runtime: no plugin module data`
90
+- Can `panic` during execution
79
 
91
 
80
 #HSLIDE
92
 #HSLIDE
81
 
93
 
82
 ## Go + C?
94
 ## Go + C?
83
 
95
 
84
 - Go plugin used in C
96
 - Go plugin used in C
85
-  - Already done with ---  <!-- .element: class="fragment" -->
97
+  - Already done with -buildmode=shared <!-- .element: class="fragment" -->
86
 - C `.so` loaded in Go
98
 - C `.so` loaded in Go
87
-  - For now, error --- <!-- .element: class="fragment" -->
99
+  - For now, error "no plugin module data" <!-- .element: class="fragment" -->
88
 
100
 
89
 #HSLIDE
101
 #HSLIDE
90
 
102