# README
goBank is the project exercise of the go backend course by techschoolgutu
This repository contains the source code and my notes about the course of back-end with go that I toke. It could be improve, it could be safer and I could extend the functionalities but I think that is beyond my original propose of familiarize with golang It could run either gin server or grpc server. The gin server has more functionality, it wasn't the idea to repeat the code all over again.
Go + Docker + PostGresSQL + AWS + Kubernetes + Github Actions + Paseto + gRPC
What is Go and how to install it
Go is a statically typed, compiled programming language designed at Google by Robert Griesemer, Rob Pike, and Ken Thompson. It is syntactically similar to C, but with memory safety, garbage collection, structural typing, and CSP-style concurrency.
curl -Lo go.tgz https://go.dev/dl/go1.19.linux-amd64.tar.gz
sudo tar -C /usr/local -xvf go.tgz
go version
This project runs Docker container
Docker is a set of platform as a service products that use OS-level virtualization to deliver software in packages called containers.
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
This project uses a dockerize PostGresSQL
This project deploys to AWS
Amazon Web Services (AWS) is the world’s most comprehensive and broadly adopted cloud platform.
Install make
Make is a build automation tool that automatically builds executable programs and libraries from source code by reading files called Makefiles which specify how to derive the target program.
Install with:
sudo apt install make
make --version
Run the project
Docker-compose:
make test
Manually:
make network
make postgres
make createdb
make migrateup
make server
make test
Gin Web Framework:
Gin is a web framework written in Go (Golang). It features a martini-like API with performance that is up to 40 times faster thanks to httprouter.
Install with:
go get -u github.com/gin-gonic/gin
Handle environment variables with Viper:
Viper is a complete configuration solution for Go applications including 12-Factor apps. It is designed to work within an application, and can handle all types of configuration needs and formats.
Install with:
go get github.com/spf13/viper
Mock-db with gomock:
gomock is a mocking framework for the Go programming language. It integrates well with Go's built-in testing package, but can be used in other contexts too.
Install with:
go install github.com/golang/mock/[email protected]
Usefull extensions
Install AWS Toolkit to interact with AWS in VSCode
Install vscode-dbml for .DBML language support
Install proto 3 for protobuf 3 language suppport
In VSCode Ctrl+p
ext install matt-meyers.vscode-dbml
ext install zxh404.vscode-proto3
ext install AmazonWebServices.aws-toolkit-vscode
Automate your workflow from idea to production
GitHub Actions makes it easy to automate all your software workflows, now with world-class CI/CD. Build, test, and deploy your code right from GitHub. Make code reviews, branch management, and issue triaging work the way you want.
Search the marketplace
Find apps to use across your development process, from continuous integration to project management and code review. Then start using them without setting up multiple accounts or payment methods.
About continuous integration
You can create custom continuous integration (CI) workflows directly in your GitHub repository with GitHub Actions.
About monitoring and troubleshooting
You can use the tools in GitHub Actions to monitor and debug your workflows.
Deploying with GitHub Actions
Learn how to control deployments with features like environments and concurrency.
Final clean up
Once I finish the course I decided to cleanup the commit history -it had a lot of unnecessary test and tries- and when I eventually revisit this project to recap some of the implementations I would like to see a smooth gh page.
The steps that I use: First delete all branches -and tags if you have some- besides master. Then unprotect the master branch
git checkout --orphan finish
git add -A
git commit -S -m "finish"
git branch -D master
git branch -m master
git push -f origin master
git gc --aggressive --prune=all