vendor gopreload
This commit is contained in:
parent
a009a9fd0f
commit
0ba19b0259
|
@ -94,3 +94,4 @@ a1a5df8f92af764f378f07d6a3dd8eb3f7aa190a github.com/xtaci/smux
|
||||||
6c23252515492caf9b228a9d5cabcdbde29f7f82 golang.org/x/net/internal/netreflect
|
6c23252515492caf9b228a9d5cabcdbde29f7f82 golang.org/x/net/internal/netreflect
|
||||||
6c23252515492caf9b228a9d5cabcdbde29f7f82 golang.org/x/net/ipv4
|
6c23252515492caf9b228a9d5cabcdbde29f7f82 golang.org/x/net/ipv4
|
||||||
8bf1e9bacbf65b10c81d0f4314cf2b1ebef728b5 github.com/streamrail/concurrent-map
|
8bf1e9bacbf65b10c81d0f4314cf2b1ebef728b5 github.com/streamrail/concurrent-map
|
||||||
|
a00a8beb369cafd88bb7b32f31fc4ff3219c3565 github.com/Xe/gopreload
|
||||||
|
|
|
@ -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
|
|
@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue