This application is meant to teach the very basics of Go programming.
- Install Go on your computer.
- On the command line, in this directory, run
go build cmd/hello/hello.go
Go should generate a binary named hello
. Run that binary with the command:
./hello
This will start a webserver on port 8180. In a web browser, access http://localhost:8180/testing
. If everything's working, you should receive a 200 OK response, and the content:
Hello, you've requested: /testing
When you're finished testing, press "Control + C" on the command line to exit the app.
- Install Docker CE on your computer.
- On the command line, in this directory, run
docker build -t hello-go .
- Run the container, bound to port
8180
:docker run --name hello-go --rm -p 8180:8180 hello-go
This will start a webserver on port 8180. In a web browser, access http://localhost:8180/testing
. If everything's working, you should receive a 200 OK response, and the content:
Hello, you've requested: /testing
When you're finished testing, press "Control + C" on the command line to exit the app.
The hello.go
example was originally derived from Go Web Examples.
This project was created by Jeff Geerling as an example for Ansible for Kubernetes.