From 1eac2aa4cc128738aa333c14c845bcc8f302181d Mon Sep 17 00:00:00 2001 From: Andy Polyakov Date: Thu, 11 Jul 2024 14:33:13 +0200 Subject: [PATCH] Add build/srcroot.go, a helper to interrogate module location. --- build/srcroot.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 build/srcroot.go diff --git a/build/srcroot.go b/build/srcroot.go new file mode 100644 index 00000000..6a2958b2 --- /dev/null +++ b/build/srcroot.go @@ -0,0 +1,14 @@ +package blst + +import ( + "path/filepath" + "runtime" +) + +var SrcRoot string + +func init() { + if _, self, _, ok := runtime.Caller(0); ok { + SrcRoot = filepath.Dir(filepath.Dir(self)) + } +}