Please refer to each project's style and contribution guidelines for submitting patches and additions. In general, we follow the "clone-and-pull" Git workflow.
- Clone the project to your own machine
- Commit changes to your own branch
- Push your work back up to your branch
- Submit a Merge Request so that anyone can review your changes
NOTE: Be sure to merge the latest from "upstream" before making a merge request!
- go version >= 1.21
- Makefile
- mockery v2.32.0
- swag
Please set your env variable. You can take example from .env.example
running http server using
make run-api
or go command
go run main.go serve-http
https://vektra.github.io/mockery/latest/installation/#go-install
$ go install github.com/vektra/mockery/v2@v2.32.0
Check version
$ mockery --version
16 Jul 23 19:16 WIB INF couldn't read any config file version=v2.32.0
16 Jul 23 19:16 WIB INF Starting mockery dry-run=false version=v2.32.0
16 Jul 23 19:16 WIB INF Using config: dry-run=false version=v2.32.0
v2.32.0
You will need mock interface for unit test. You can run command to make mock for all required directories:
make remock
$ go get -u github.com/swaggo/swag/cmd/swag@v1.8.12
Register on bash or zsh
$ sudo nano ~/.zshrc
// ...
export PATH=$(go env GOPATH)/bin:$PATH
// save
$ source ~/.zshrc
http://{HOST}/docs/index.html
update swagger docs file manually by running command
make swag-init
accessing swagger docs using
http://localhost:8900/docs/index.html
enable/disable swagger docs by configuration properties, default is enabled
Reference:
$ go install -tags "mysql" github.com/golang-migrate/migrate/v4/cmd/migrate@latest
$ migrate create -ext sql -dir db/migrations [name_of_migration_file]
$ migrate -database "mysql://user:password@tcp(host:port)/dbname?query" -path db/migrations up
$ migrate -database "mysql://user:password@tcp(host:port)/dbname?query" -path db/migrations down