Page tree

Michael O'Brien

Skip to end of metadata
Go to start of metadata


OSX and Windows

On your mac - install  currently 1.14.4

# restart your terminal to pick up the path
PS C:\WINDOWS\system32> go version
go version go1.13.6 windows/amd64

# write some code
obrienlabs:wse_go michaelobrien$ vi hello.go

package main
import "fmt"
func main() {
        fmt.Printf("hello world\n")

# compile it
obrienlabs:wse_go michaelobrien$ go build hello.go
obrienlabs:wse_go michaelobrien$ ./hello 
hello world

GO on Docker

Build your go file inside the docker image

biometric:wse_go michaelobrien$ docker build -t golang-app .
Sending build context to Docker daemon  4.246MB
Step 1/6 : FROM golang:1.13
1.8: Pulling from library/golang
4176fe04cefe: Pull complete 
851356ecf618: Pull complete 
6115379c7b49: Pull complete 
69914558965c: Pull complete 
b108f9aa98db: Pull complete 
df7abcd2981e: Pull complete 
3e60cb3f592b: Pull complete 
Digest: sha256:f0b5dab7581eddb49dabd1d1b9aa505ca3edcdf79a66395b5bfa4f3c036b49ef
Status: Downloaded newer image for golang:1.13
 ---> 0d283eb41a92
Step 2/6 : WORKDIR /go/src/app
 ---> Running in a507559be93a
Removing intermediate container a507559be93a
 ---> 4b25297919dd
Step 3/6 : COPY . .
 ---> c27681a4791e
Step 4/6 : RUN go get -d -v ./...
 ---> Running in f48db41e9c33
Removing intermediate container f48db41e9c33
 ---> d66e3d554a97
Step 5/6 : RUN go install -v ./...
 ---> Running in 9d12eee75491
Removing intermediate container 9d12eee75491
 ---> b2e598b8c581
Step 6/6 : CMD ["app"]
 ---> Running in ee7365f812b7
Removing intermediate container ee7365f812b7
 ---> 479e75b4cd5e
Successfully built 479e75b4cd5e
Successfully tagged golang-app:latest
biometric:wse_go michaelobrien$ docker run -it --rm --name my-golang-app golang-app
hello world

Go on Kubernetes

Golang is used as one of the languages in writing Kubernetes Operators Kubernetes Developer Guide#KubernetesNativeApplications-KubernetesOperator

  • No labels