diff options
Diffstat (limited to 'vendor/github.com')
| -rw-r--r-- | vendor/github.com/Xe/gopreload/doc.go | 7 | ||||
| -rw-r--r-- | vendor/github.com/Xe/gopreload/preload.go | 26 |
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 + } + } +} |
