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
41
42
//go:build !release
package assets
import (
"fmt"
"os"
"path/filepath"
"runtime"
)
func Release() bool { return false }
func Platform() string { return runtime.GOOS + "/" + runtime.GOARCH }
func Ready() error { return nil }
func Resolve(opts Options, executable string) (Exec, error) {
p := opts.Paths[executable]
if p == "" {
return Exec{}, fmt.Errorf("assets: this dev build embeds no assets; give %s by its explicit path option (never PATH)", executable)
}
if !filepath.IsAbs(p) {
return Exec{}, fmt.Errorf("assets: %s path %q is not absolute; a dev build never searches PATH", executable, p)
}
st, err := os.Stat(p)
if err != nil {
return Exec{}, fmt.Errorf("assets: %s: %w", executable, err)
}
if !st.Mode().IsRegular() || st.Mode().Perm()&0o111 == 0 {
return Exec{}, fmt.Errorf("assets: %s path %s is not an executable file", executable, p)
}
e := Exec{Name: executable, Path: p}
if pins, err := platformPins(Platform()); err == nil {
if pin, ok := PinFor(pins, executable); ok {
e.Asset, e.Version = pin.Name, pin.Version
}
}
return e, nil
}
func embeddedBlob(name string) bool { return false }