aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/Xe
diff options
context:
space:
mode:
authorChristine Dodrill <me@christine.website>2017-03-25 11:01:39 -0700
committerChristine Dodrill <me@christine.website>2017-03-25 11:01:39 -0700
commit9b16f8a021d25eaedaec4726f5ee924a17615921 (patch)
treeb90bde7685fb8109faf1a6e4637ff7402b8e82fb /vendor/github.com/Xe
parent62918fa6ea36d0c6310d2fa22343db9fddad94e5 (diff)
downloadxesite-9b16f8a021d25eaedaec4726f5ee924a17615921.tar.xz
xesite-9b16f8a021d25eaedaec4726f5ee924a17615921.zip
Add gopreload as a dependency
Diffstat (limited to 'vendor/github.com/Xe')
-rw-r--r--vendor/github.com/Xe/gopreload/doc.go7
-rw-r--r--vendor/github.com/Xe/gopreload/preload.go26
2 files changed, 33 insertions, 0 deletions
diff --git a/vendor/github.com/Xe/gopreload/doc.go b/vendor/github.com/Xe/gopreload/doc.go
new file mode 100644
index 0000000..720c5c1
--- /dev/null
+++ b/vendor/github.com/Xe/gopreload/doc.go
@@ -0,0 +1,7 @@
+/*
+Package gopreload is a bit of a hack to emulate the behavior of LD_PRELOAD [ld-preload].
+This allows you to have automatically starting instrumentation, etc.
+
+[ld-preload]: http://man7.org/linux/man-pages/man8/ld.so.8.html (see LD_PRELOAD section)
+*/
+package gopreload
diff --git a/vendor/github.com/Xe/gopreload/preload.go b/vendor/github.com/Xe/gopreload/preload.go
new file mode 100644
index 0000000..1b5a0c9
--- /dev/null
+++ b/vendor/github.com/Xe/gopreload/preload.go
@@ -0,0 +1,26 @@
+//+build linux,go1.8
+
+package gopreload
+
+import (
+ "log"
+ "os"
+ "plugin"
+ "strings"
+)
+
+func init() {
+ gpv := os.Getenv("GO_PRELOAD")
+ if gpv == "" {
+ return
+ }
+
+ for _, elem := range strings.Split(gpv, ",") {
+ log.Printf("gopreload: trying to open: %s", elem)
+ _, err := plugin.Open(elem)
+ if err != nil {
+ log.Printf("%v from GO_PRELOAD cannot be loaded: %v", elem, err)
+ continue
+ }
+ }
+}