-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.go
67 lines (60 loc) · 1.24 KB
/
main.go
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package main
import (
"flag"
"fmt"
"os"
"github.com/ii64/golinker/cmd"
"github.com/ii64/golinker/conf"
)
func _main(args []string) {
var err error
var exitCode int
cfg := conf.Default()
fs := cfg.FlagSet("golinker", flag.ExitOnError)
oldUsage := fs.Usage
fs.Usage = func() {
oldUsage()
fs.PrintDefaults()
exitCode = 0
os.Exit(exitCode)
}
err = fs.Parse(args)
if err != nil {
goto Exit
}
err = cfg.Vaildate()
if err != nil {
goto Exit
}
err = cmd.Main(cfg)
if err != nil {
goto Exit
}
Exit:
if err != nil {
fmt.Fprintf(os.Stderr, "error: %s\n\n", err)
fs.Usage()
exitCode = 1
}
os.Exit(exitCode)
}
func main() {
_main(os.Args[1:])
// _main([]string{
// // "-extld=ld",
// // "-out=./_example/internal/native",
// "-out=./_sample/_exp/go/hdr",
// // "-stub=./_example/internal/native/stub.go",
// // "-stub=./_sample/_exp/go/hdr/hdr.go",
// "-stub=./_sample/_exp/go/hdr/uring.go",
// // "-entryname=__native_entry2__",
// "-fallback-rawbytes-x86",
// // "-rawbytes-x86",
// "-extsymstub",
// // "./_sample/_exp/libexp-amd64.a",
// // "./_example/native/libnative-amd64.a",
// "/usr/lib/liburing.a",
// // "-extld=aarch64-linux-gnu-ld",
// // "./_sample/_exp/libexp-arm64.a",
// })
}