Golang roadmap

License Written in Go GitHub release PRs Welcome Docker Downloads Contributors Documentation Last Update

Init

Init project module

go mod init github.com/jrfernandodasilva/golang-roadmap

Check modules dependencies

go mod tidy -v

Run

go run main.go

Build with specific name

go build -o golang-roadmap main.go

Build to specific OS

GOOS=linux GOARCH=amd64 go build -o golang-roadmap main.go
GOOS=windows GOARCH=amd64 go build -o golang-roadmap.exe main.go
GOOS=darwin GOARCH=amd64 go build -o golang-roadmap main.go
GOOS=android GOARCH=arm64 go build -o golang-roadmap main.go

Format code file

go fmt main.go

Run tests

go test -v

Run tests with specific package

go test -v ./functions

Run tests with specific package and file

go test -v ./math/int_operations_test.go

Run tests with specific package and file with specific function

go test -v ./math/int_operations_test.go -run TestAddInt

Benchmark Tests

cd benchmark
go test -v -bench=. -benchmem

Project Structure

See project structure suggestion in Wiki

Docker Commands

Action Description Command
build Builds the container image from the Dockerfile docker build -t golang-roadmap:unstable .
run To runs the container image docker run -d --rm --name golang-roadmap-app golang-roadmap:unstable
sh To open a shell in the container docker exec -it golang-roadmap-app sh
logs To view the logs of the container docker logs golang-roadmap-app
stop To stop the container docker stop golang-roadmap-app
rm To remove the container docker rm golang-roadmap-app