Skip to content

hu-tao-supremacy/facility

Repository files navigation

Facility Service

Go Report Card License: MIT Test Code Coverage

  1. Setting up PostgreSQL for dev environment
docker-compose -f docker-compose.dev.yaml up -d
  1. Run Makefile for cloning service proto and symlink
make apis
  1. Run migration for database
git clone https://github.com/hu-tao-supremacy/migrations/
cd migrations
yarn
make migrate
  1. Prepare Go's env
source dev-env
  1. Code
code .
  1. Run
go run ./cmd/!(*_test).go

Build binary file

  1. Run go build command
go build -o main ./cmd/*.go
  1. Execute binary file
./main

Testing

  • Coverage
go test  -cover  $(go list ./... | grep -v hts) -coverprofile=coverage.out
  • View test coverage in terminal
go tool cover -func=coverage.out
  • View test coverage in html format
go tool cover -html=coverage.out -o coverage.html

WSL2 guide

  • make sure you have setup Docker Desktop and connected to WSL2
  • for connecting with WSL2's GRPC port from windows
    • run wsl hostname -I on windows cmd to find WSL2 ip address

Direct connection to PosgresSQL

psql -U username -h localhost -p 5432 dbname