Permalink
Browse files

Add presentation for Go Meetup 23rd Feb 2017

  • Loading branch information...
SchumacherFM committed Feb 12, 2017
1 parent 06e9f64 commit 303cf021442a5f948766a9f20ab41aba26cf7dc8
@@ -0,0 +1,27 @@
+<html>
+ <body>
+<pre>CyS at MBP in ~/GoPro/src/github.com/SchumacherFM/caddyesi on master [!?]
+$ ./caddyesi.test -test.run=XXX -test.bench=Middleware/ServeHTTP_Parallel -test.mutexprofile=zmutex.out
+BenchmarkMiddleware/ServeHTTP_Parallel-4 30000 39157 ns/op 46006 B/op 66 allocs/op
+PASS
+
+CyS at MBP in ~/GoPro/src/github.com/SchumacherFM/caddyesi on master [!?]
+$ go tool pprof ./caddyesi.test zmutex.out
+Entering interactive mode (type "help" for commands)
+(pprof) top
+903.14us of 903.14us total ( 100%)
+Showing top 10 nodes out of 36 (cum >= 76.08us)
+ flat flat% sum% cum cum%
+ 903.14us 100% 100% 903.14us 100% sync.(*Mutex).Unlock
+ 0 0% 100% 107.02us 11.85% fmt.(*pp).free
+ 0 0% 100% 503.53us 55.75% fmt.Sprintf
+ 0 0% 100% 396.51us 43.90% fmt.newPrinter
+ 0 0% 100% 399.61us 44.25% github.com/SchumacherFM/caddyesi.(*Middleware).ServeHTTP
+ 0 0% 100% 173.48us 19.21% github.com/SchumacherFM/caddyesi.(*PathConfig).ESITagsByRequest
+ 0 0% 100% 21.91us 2.43% github.com/SchumacherFM/caddyesi.(*PathConfig).pageID
+ 0 0% 100% 226.13us 25.04% github.com/SchumacherFM/caddyesi.(*injectingWriter).Write
+ 0 0% 100% 21.91us 2.43% github.com/SchumacherFM/caddyesi.pageID
+ 0 0% 100% 76.08us 8.42% github.com/SchumacherFM/caddyesi/bufpool.Get
+(pprof)</pre>
+ </body>
+</html>
@@ -0,0 +1,29 @@
+package main
+
+import (
+ "fmt"
+ "plugin"
+)
+
+func main() {
+ // START OMIT
+ fmt.Printf("main started...\n")
+ p, err := plugin.Open("plugin.so")
+ if err != nil {
+ panic(err)
+ }
+
+ v, err := p.Lookup("V")
+ if err != nil {
+ panic(err)
+ }
+
+ f, err := p.Lookup("F")
+ if err != nil {
+ panic(err)
+ }
+
+ *v.(*int) = 7
+ f.(func())() // prints "Hello, number 7"
+ // END OMIT
+}
@@ -0,0 +1,16 @@
+package main
+
+// // No C code needed.
+import "C"
+
+import "fmt"
+
+var V int
+
+func init() {
+ fmt.Println("Plugin loading")
+}
+
+func F() {
+ fmt.Printf("Hello, number %d\n", V)
+}
@@ -0,0 +1,11 @@
+func example() {
+ type T1 struct {
+ X int `json:"foo"`
+ }
+ type T2 struct {
+ X int `json:"bar"`
+ }
+ var v1 T1
+ var v2 T2
+ v1 = T1(v2) // now legal
+}
@@ -0,0 +1,9 @@
+package main
+
+type T struct {
+ A string `json:"A"`
+ // vet error: struct field B repeats json tag "A" also at vet_repeated_tags.go:4
+ B string `json:"A"`
+ // vet error: not compatible with reflect.StructTag.Get: key:"value" pairs not separated by spaces
+ C string `json:"C"xml:"C"`
+}
Oops, something went wrong.

0 comments on commit 303cf02

Please sign in to comment.