occlum/demos/golang/README.md
LI Qing 6d72e10fc1 Add Golang toolchain and the demo
This commit provides a modified Go runtime in Docker image.
Now we can build a Go program using `occlum-go`, then run it
in SGX enclaves by Occlum.
The Golang demo demonstrates how to build and run a web server
program written in Go.
2020-05-15 03:02:42 +00:00

21 lines
619 B
Markdown

# Use Golang with Occlum
This project demonstrates how Occlum enables [Golang](https://golang.org) programs running in SGX enclaves.
Step 1: Build Golang web server program using the Occlum Golang toolchain(i.e., `occlum-go`)
```
occlum-go build -o web_server -buildmode=pie ./web_server.go
```
Step 2: You can run the web server demo on Occlum via
```
./run_golang_on_occlum.sh
```
The HTTP web server should now start to listen on port 8090 and serve HTTP requests.
Step 3: To check whether the HTTP server works, run
```
curl http://127.0.0.1:8090/hello1
```
in another terminal, and get the response "hello,1".