Project_Corp is about project management and its participants.
documentation resides at ./doc folder.
Project is created with:
- Go
- Gin
- Postgres
- Docker
Note: The app will start with a seeder.
$ docker-compose up -d
Application will be running on port 3000 and endpoints available are:
$ curl http://localhost:3000/projects
$ curl -d '{"name":"newProject","department":"sales","owner": "b82522f0-8644-4c65-a552-9c6b8a9e4b6f"}' -H "Content-Type: application/json" -X POST http://localhost:3000/projects
$ curl -d '{"name":"oldProject","department":"sales","owner": "b82522f0-8644-4c65-a552-9c6b8a9e4b6f"}' -H "Content-Type: application/json" -X PUT http://localhost:3000/projects/9eb8e365-3d7e-4994-960d-e51275343f23
$ curl -d '{"id":"a0d5e87a-af04-473d-b1f5-3105bbf986c8","department":"sales","role":"employee"}' -H "Content-Type: application/json" -X POST http://localhost:3000/projects/9eb8e365-3d7e-4994-960d-e51275343f23/participants
More details on endpoint specification in the doc folder.
1. First get a bash shell in the container
$ docker-compose exec corp_go bash
2. Execute all test cases with coverage
$ go test -cover -v ./...
3. Execute test cases for a specific package [optional]
$ go test -cover -v ./adapters/rest/controllers/project -v
$ go test -cover -v ./domain/usecase/project -v
4. Execute only unit test cases [optional]
$ go test -short -cover -v ./...
5. Execute only integration test cases [optional]
go test -v -run ".Integration" ./...
Project uses golangci-lint. It is a go linter aggregator that can enable up to 48 linters.
golanci-lint configuration is found in .golangci.yml file.
# binary installation for linux and Windows, binary will be $(go env GOPATH)/bin/golangci-lint
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.35.2
Check if the tool is correctly installed
golangci-lint --version
golangci-lint run
golangci-lint print out warning messages in command-line related to the enabled linters in order to fix them.
To format all files in the project based on the gofmt linter. Ref
gofmt -s -w -l .
To fix go import packages linting warnings based on goimport linter. Ref
goimports -local ./ -w .
Guide How you should group your package based on golang structure.
- Implement more coverage with Unit Test
- Implement intergration tests
- Implement functional tests