指南
Tableau Go API 使用指南。
前置条件
- Go,任意最新三个主要版本之一,参考 Go 发布记录。
- 安装说明请参考 Go 的 Getting Started 指南。
- Protocol buffer 编译器
protoc,版本 3。 - 协议编译器的 Go 插件:
使用以下命令安装 Go 的协议编译器插件:
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.26更新 PATH,使 protoc 编译器能找到插件:
export PATH="$PATH:$(go env GOPATH)/bin"
获取示例代码
示例代码位于 tableau/demo 仓库。
下载仓库 zip 包 并解压,或克隆仓库:
git clone https://github.com/tableauio/demo切换到快速开始示例目录:
cd demo/examples/helloworld
运行示例
在 examples/helloworld 目录下:
切换到 excel2proto 目录,编译并执行:
go run main.goproto 文件将生成到
examples/helloworld/proto。切换到 excel2conf 目录,生成
*.pb.go后编译并执行:bash gen.sh go run main.go*.pb.go文件将生成到examples/helloworld/protoconf,JSON 文件将生成到examples/helloworld/excel2conf/_out。
恭喜!你已经成功运行了一个使用 Tableau 的现代化配置转换应用。