Golang嵌入可执行程序
reddit链接 On Linux it might be possible to use the memfd_create system call, but that’s not portable to other operating systems. need go 1.16 + package main import ( _ "embed" "log" "os" "os/exec" "strconv" "golang.org/x/sys/unix" ) //go:embed binary var embeddedBinary []byte func main() { fd, err := unix.MemfdCreate("embedded_binary", 0) if err != nil { log.Fatal(err) } path := "/proc/" + strconv.Itoa(os.Getpid()) + "/fd/" + strconv.Itoa(int(fd)) err = os.WriteFile(path, embeddedBinary, 0755) if err !...