快速开始
This guide gets you started with Tableau in Go with a simple working example.
On this page
Prerequisites
- Go, any one of the three latest major releases of Go.
- For installation instructions, see Go’s Getting Started guide.
- Protocol buffer compiler,
protoc
, version 3.- For installation instructions, see Protocol Buffer Compiler Installation.
- Go plugins for the protocol compiler:
Install the protocol compiler plugins for Go using the following commands:
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.26
Update your PATH so that the protoc compiler can find the plugins:
export PATH="$PATH:$(go env GOPATH)/bin"
Get the example code
The example code is part of the tableau/demo repo.
Download the repo as a zip file and unzip it, or clone the repo:
git clone https://github.com/tableauio/demo
Change to the quick start example directory:
cd demo/examples/helloworld
Run the example
From the examples/helloworld
directory:
Change dir to excel2proto, compile and execute:
go run main.go
Then proto files will be generated to
examples/helloworld/proto
.Change dir to excel2conf, generate
*.pb.go
and then compile and execute:bash gen.sh go run main.go
Then
*.pb.go
files will be generated toexamples/helloworld/protoconf
, and JSON files will be generated toexamples/helloworld/excel2conf/_out
.
Congratulations! You’ve just run a modern configuration converter application with Tableau.