This image contains pre-installed tools helpful for development purposes.
Also this image can be used as part of build process (lint, test, cover, etc.)
- dep
- golint
- gometalinter (< v1.12)
- golangci-lint
- cover
- goveralls
- dlv
- gin
- gosec
- pprof
- google-app-enginee (v1.10)
Create test package with purpose to check this docker image:
package main
func main() {
println("It works!")
}
Now you can run next command:
docker run -it --rm -v $PWD:/app -w /app cn007b/go go run main.go
And you can run next command to check that everything is ok:
docker run -it --rm -v $PWD:/app -w /app cn007b/go sh -c '
go vet
go fmt ./...
golint ./...
golangci-lint run
gosec -tests ./...
'
package main
import (
"net/http"
)
func main() {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("Hello world!"))
})
http.ListenAndServe(":8080", nil)
}
Now you can run next command:
docker run -it --rm -p 80:80 -v $PWD:/app -w /app cn007b/go sh -c \
'gin --port 80 --appPort 8080 run main.go'
# and
curl localhost:80
With purpose to use google-app-enginee
please use next commands:
docker run -it --rm cn007b/go:1.10-gae gcloud version
docker run -it --rm cn007b/go:1.10-gae goapp version