func getModuleRoot() string {
	uname := unix.Utsname{}
	if err := unix.Uname(&uname); err != nil {
		panic(err)
	}
	i := 0
	for ; uname.Release[i] != 0; i++ {
	}
	return filepath.Join(
		"/lib/modules",
		string(uname.Release[:i]),
	)
}
Get the module root (/lib/modules/$(uname -r)/)
package modprobe
import (
	"fmt"
	"os"
	"path/filepath"
	"strings"
	"debug/elf"
	"golang.org/x/sys/unix"
)
var (
	moduleRoot = getModuleRoot()
)