-
-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathembed_modules.go
More file actions
40 lines (35 loc) · 1.82 KB
/
Copy pathembed_modules.go
File metadata and controls
40 lines (35 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*
·━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━·
: :
: █▀ █ █▀▀ · Blazing-fast pentesting suite :
: ▄█ █ █▀ · BSD 3-Clause License :
: :
: (c) 2022-2026 vmfunc, xyzeva, :
: lunchcat alumni & contributors :
: :
·━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━·
*/
package sif
import (
"embed"
"io/fs"
"github.com/charmbracelet/log"
"github.com/vmfunc/sif/internal/modules"
)
// builtinModules embeds the module tree into the binary. this file lives at the
// repo root because go:embed cannot reference a parent directory, and modules/
// sits above internal/modules where the loader lives.
//
//go:embed modules
var builtinModules embed.FS
// register the embedded modules with the loader once, rooted at the modules
// directory so paths match the on-disk layout. the loader only uses this as a
// fallback when no filesystem modules/ dir is present.
func init() {
sub, err := fs.Sub(builtinModules, "modules")
if err != nil {
log.Debugf("embedded modules unavailable: %v", err)
return
}
modules.SetBuiltinFS(sub)
}