Giter VIP home page Giter VIP logo

go_clean_architecture's Introduction

Go Clean Architecture

Clean Architecture with Golang with Dependency Injection

Use of Linter in the project

To install all the packages and run the linter in git pre-commit hook; Run

Make lint-setup

Run Migration Commands

⚓️   Add argument p=host after make if you want to run the migration runner from the host environment instead of docker environment. example; make p=host migrate-up

If you are not using docker; ensure that sql-migrate is installed to use migration from the host environment. To install sql-migrate:

go get -v github.com/rubenv/sql-migrate/...

Migration commands available
Command Desc
make migrate-status Show migration status
make migrate-up Migrates the database to the most recent version available
make migrate-down Undo a database migration
make redo Reapply the last migration
make create Create new migration file

Run app with docker

  • Update database env variables with credentials defined in docker-compose.yml
  • Start server using command docker-compose up -d or sudo docker-compose up -d if permission issues

    Assumes: Docker is already installed in the machine.

Run app without docker

  • Run go run main.go app:serve to run app server.
  • There are other commands available as well. You can run go run main.go -help to know about other commands available.

Testing

The framework comes with unit and integration testing support out of the box. You can check examples written in tests directory. To run the test just run: go test ./... -v

For test coverage

  • go test ./... -v -coverprofile cover.txt -coverpkg=./...
  • go tool cover -html=cover.txt -o index.html

Checking API documents with swagger UI

Browse to http://localhost:${SWAGGER_PORT}

Update Dependencies

Steps to Update Dependencies
  1. go get -u
  2. Remove all the dependencies packages that has // indirect from the modules
  3. go mod tidy
Discovering available updates

List all of the modules that are dependencies of your current module, along with the latest version available for each:

$ go list -m -u all

Display the latest version available for a specific module:

$ go list -m -u example.com/theirmodule

Example:

$ go list -m -u cloud.google.com/go/firestore
cloud.google.com/go/firestore v1.2.0 [v1.6.1]

Getting a specific dependency version

To get a specific numbered version, append the module path with an @ sign followed by the version you want:

$ go get example.com/[email protected]

To get the latest version, append the module path with @latest:

$ go get example.com/theirmodule@latest

Synchronizing your code’s dependencies

$ go mod tidy

go_clean_architecture's People

Contributors

dipeshdulal avatar cyantosh0 avatar sujalkokh avatar denes-cilwal avatar pragyanaryal avatar dipeshhkc avatar bibek-magar avatar pushanmaharjan avatar binodkafle avatar ujjwolkayastha avatar dependabot[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.