本文介紹llgo的使用。
安裝llgo,需要翻墻
# Ensure $GOPATH is set.
go get -d github.com/go-llvm/llgo/cmd/gllgo
$GOPATH/src/llvm.org/llvm/bindings/go/build.sh -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD=host
cd $GOPATH/src/github.com/go-llvm/llgo
make install prefix=/path/to/prefix j=N # where N is the number of cores on your machine.
編寫代碼 test.go
package main
import "fmt"
func main() {
fmt.Println("vim-go")
}
執(zhí)行命令:
llgo -dump test.go
輸出:
#