build a golang program with binary package
首先你需要 golang 1.7
1. create your binary package
file: /simple/myframework/hi.go
package my
import "fmt"
func Say() {
fmt.Print("Hello World")
}
run command go build -i
there will be a binary package in your $GOPATH/pkg/myframework.a
2. rewrite your code
//go:binary-only-package
package myframework
3. write your program
file: /simple/main.go
package main
import my "simple/myframework"
func main() {
my.Say()
}
run the command go build && simple.exe