1
0
mirror of https://github.com/fumiama/terasu.git synced 2026-06-05 01:00:23 +08:00
Files
terasu/ext/init.go
2026-02-16 16:10:52 +08:00

26 lines
576 B
Go

package ext
import (
"os"
"plugin"
"github.com/sirupsen/logrus"
)
const (
TRSPluginFile = "./terasu.plugin.so"
)
func init() {
if _, err := os.Stat(TRSPluginFile); err != nil {
return
}
_, err := plugin.Open(TRSPluginFile)
if err != nil {
logrus.Warnln("[terasu.plugin] load ext", TRSPluginFile, "err:", err)
logrus.Warnln("[terasu.plugin] hint: ensure the main binary and plugin are built with identical flags (e.g. both use -trimpath -ldflags=\"-s -w\"), and avoid using 'go run'")
return
}
logrus.Infoln("[terasu.plugin] loaded ext", TRSPluginFile)
}