Skip to content

Commit

Permalink
Update versions
Browse files Browse the repository at this point in the history
  • Loading branch information
GSabadini committed Nov 13, 2023
1 parent c6b5d78 commit d4f84f7
Show file tree
Hide file tree
Showing 60 changed files with 325 additions and 330 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ jobs:
test:
strategy:
matrix:
go-version: [1.16.x]
go-version: [1.21.x]
platform: [ubuntu-latest]
runs-on: ${{ matrix.platform }}
steps:
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: go

go:
- 1.16.x
- 1.21.x

script:
- make test-local
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.16 AS base
FROM golang:1.21 AS base
WORKDIR /app
COPY . .

Expand All @@ -12,9 +12,9 @@ ENTRYPOINT ["dlv", "debug", "--listen=:40000", "--headless", "--accept-multiclie
FROM base AS development
WORKDIR /app
COPY . .
RUN go get github.com/pilu/fresh
RUN go install github.com/cosmtrek/air@latest
EXPOSE 3001
ENTRYPOINT ["fresh"]
ENTRYPOINT ["air"]

FROM base AS builder
WORKDIR /app
Expand Down
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
ENVIRONMENT=development
SYSTEM=go-bank-transfer
SYSTEM=go-clean-architecture
SYSTEM_VERSION=$(shell git branch --show-current | cut -d '/' -f2)
PWD=$(shell pwd -L)
DOCKER_RUN=docker run --rm -it -w /app -v ${PWD}:/app -v ${GOPATH}/pkg/mod/cache:/go/pkg/mod/cache golang:1.16-buster
DOCKER_RUN=docker run --rm -it -w /app -v ${PWD}:/app -v ${GOPATH}/pkg/mod/cache:/go/pkg/mod/cache golang:1.21

.PHONY: all
all: help
Expand All @@ -27,13 +27,13 @@ test: ## Run golang tests

.PHONY: test-report
test-report: ## Run tests with HTML coverage report
${DOCKER_RUN} go test -covermode=count -coverprofile coverage.out -p=1 ./... && \
${DOCKER_RUN} go test -covermode=count -coverprofile coverage.out ./... && \
go tool cover -html=coverage.out -o coverage.html && \
xdg-open ./coverage.html

.PHONY: test-report-func
test-report-func: ## Run tests with func report -covermode=set
${DOCKER_RUN} go test -covermode=set -coverprofile=coverage.out -p=1 ./... && \
${DOCKER_RUN} go test -covermode=set -coverprofile=coverage.out ./... && \
go tool cover -func=coverage.out

.PHONY: test-report-text
Expand Down Expand Up @@ -101,7 +101,7 @@ docker-run: docker-deps ## Run docker container for image project
-e SYSTEM_VERSION=$(SYSTEM_VERSION) \
-p 3001:3001 \
--env-file .env \
--network go-bank-transfer_bank \
--network go-clean-architecture_main \
--name $(SYSTEM)-$(SYSTEM_VERSION) gsabadini/$(SYSTEM):$(SYSTEM_VERSION)

docker-deps:
Expand Down
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
<h1 align="center">Welcome to Go Bank Transfer :bank:</h1>
<h1 align="center">Welcome to Go Clean Architecture</h1>
<p>
<img alt="Version" src="https://img.shields.io/badge/version-1.10.0-blue.svg?cacheSeconds=2592000" />
<a href="https://goreportcard.com/badge/github.com/GSabadini/go-bank-transfer" target="_blank">
<img alt="Build" src="https://goreportcard.com/badge/github.com/GSabadini/go-bank-transfer" />
<img alt="Version" src="https://img.shields.io/badge/version-1.11.0-blue.svg?cacheSeconds=2592000" />
<a href="https://goreportcard.com/badge/github.com/GSabadini/go-clean-architecture" target="_blank">
<img alt="Build" src="https://goreportcard.com/badge/github.com/GSabadini/go-clean-architecture" />
</a>
<a href="#" target="_blank">
<img alt="License: MIT" src="https://img.shields.io/badge/License-MIT-yellow.svg" />
</a>
<a href="https://travis-ci.org/github/GSabadini/go-bank-transfer" target="_blank">
<img alt="Build" src="https://travis-ci.org/GSabadini/go-bank-transfer.svg?branch=master" />
<a href="https://travis-ci.org/github/GSabadini/go-clean-architecture" target="_blank">
<img alt="Build" src="https://travis-ci.org/GSabadini/go-clean-architecture.svg?branch=master" />
</a>
<a href="https://github.com/GSabadini/go-bank-transfer/actions" target="_blank">
<img src="https://github.com/GSabadini/go-bank-transfer/workflows/test/badge.svg" />
<a href="https://github.com/GSabadini/go-clean-architecture/actions" target="_blank">
<img src="https://github.com/GSabadini/go-clean-architecture/workflows/test/badge.svg" />
</a>
<a href="https://codecov.io/gh/GSabadini/go-bank-transfer">
<img src="https://codecov.io/gh/GSabadini/go-bank-transfer/branch/master/graph/badge.svg" />
<a href="https://codecov.io/gh/GSabadini/go-clean-architecture">
<img src="https://codecov.io/gh/GSabadini/go-clean-architecture/branch/master/graph/badge.svg" />
</a>
</p>

- The Go Bank Transfer API is a user-friendly solution designed for a range of banking tasks, including account creation, account listing, checking the balance of specific accounts, facilitating transfers between accounts, and compiling transfer records.
- The Go Clean Architecture is a user-friendly solution designed for a range of banking tasks, including account creation, account listing, checking the balance of specific accounts, facilitating transfers between accounts, and compiling transfer records.

## Architecture
- This represents an endeavor to implement a clean architecture. In the event that you're not yet familiar with it, I'd like to provide you with a [reference](https://blog.cleancoder.com/uncle-bob/2012/08/13/the-clean-architecture.html).
Expand Down
10 changes: 5 additions & 5 deletions adapter/api/action/create_account.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import (
"net/http"
"strings"

"github.com/gsabadini/go-bank-transfer/adapter/api/logging"
"github.com/gsabadini/go-bank-transfer/adapter/api/response"
"github.com/gsabadini/go-bank-transfer/adapter/logger"
"github.com/gsabadini/go-bank-transfer/adapter/validator"
"github.com/gsabadini/go-bank-transfer/usecase"
"github.com/gsabadini/go-clean-architecture/adapter/api/logging"
"github.com/gsabadini/go-clean-architecture/adapter/api/response"
"github.com/gsabadini/go-clean-architecture/adapter/logger"
"github.com/gsabadini/go-clean-architecture/adapter/validator"
"github.com/gsabadini/go-clean-architecture/usecase"
)

type CreateAccountAction struct {
Expand Down
6 changes: 3 additions & 3 deletions adapter/api/action/create_account_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import (
"testing"
"time"

"github.com/gsabadini/go-bank-transfer/infrastructure/log"
"github.com/gsabadini/go-bank-transfer/infrastructure/validation"
"github.com/gsabadini/go-bank-transfer/usecase"
"github.com/gsabadini/go-clean-architecture/infrastructure/log"
"github.com/gsabadini/go-clean-architecture/infrastructure/validation"
"github.com/gsabadini/go-clean-architecture/usecase"
)

type mockAccountCreateAccount struct {
Expand Down
12 changes: 6 additions & 6 deletions adapter/api/action/create_transfer.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import (
"errors"
"net/http"

"github.com/gsabadini/go-bank-transfer/adapter/api/logging"
"github.com/gsabadini/go-bank-transfer/adapter/api/response"
"github.com/gsabadini/go-bank-transfer/adapter/logger"
"github.com/gsabadini/go-bank-transfer/adapter/validator"
"github.com/gsabadini/go-bank-transfer/domain"
"github.com/gsabadini/go-bank-transfer/usecase"
"github.com/gsabadini/go-clean-architecture/adapter/api/logging"
"github.com/gsabadini/go-clean-architecture/adapter/api/response"
"github.com/gsabadini/go-clean-architecture/adapter/logger"
"github.com/gsabadini/go-clean-architecture/adapter/validator"
"github.com/gsabadini/go-clean-architecture/domain"
"github.com/gsabadini/go-clean-architecture/usecase"
)

type CreateTransferAction struct {
Expand Down
8 changes: 4 additions & 4 deletions adapter/api/action/create_transfer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import (
"testing"
"time"

"github.com/gsabadini/go-bank-transfer/domain"
"github.com/gsabadini/go-bank-transfer/infrastructure/log"
"github.com/gsabadini/go-bank-transfer/infrastructure/validation"
"github.com/gsabadini/go-bank-transfer/usecase"
"github.com/gsabadini/go-clean-architecture/domain"
"github.com/gsabadini/go-clean-architecture/infrastructure/log"
"github.com/gsabadini/go-clean-architecture/infrastructure/validation"
"github.com/gsabadini/go-clean-architecture/usecase"
)

type mockCreateTransfer struct {
Expand Down
10 changes: 5 additions & 5 deletions adapter/api/action/find_account_balance.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ package action
import (
"net/http"

"github.com/gsabadini/go-bank-transfer/adapter/api/logging"
"github.com/gsabadini/go-bank-transfer/adapter/api/response"
"github.com/gsabadini/go-bank-transfer/adapter/logger"
"github.com/gsabadini/go-bank-transfer/domain"
"github.com/gsabadini/go-bank-transfer/usecase"
"github.com/gsabadini/go-clean-architecture/adapter/api/logging"
"github.com/gsabadini/go-clean-architecture/adapter/api/response"
"github.com/gsabadini/go-clean-architecture/adapter/logger"
"github.com/gsabadini/go-clean-architecture/domain"
"github.com/gsabadini/go-clean-architecture/usecase"
)

type FindAccountBalanceAction struct {
Expand Down
6 changes: 3 additions & 3 deletions adapter/api/action/find_account_balance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (
"strings"
"testing"

"github.com/gsabadini/go-bank-transfer/domain"
"github.com/gsabadini/go-bank-transfer/infrastructure/log"
"github.com/gsabadini/go-bank-transfer/usecase"
"github.com/gsabadini/go-clean-architecture/domain"
"github.com/gsabadini/go-clean-architecture/infrastructure/log"
"github.com/gsabadini/go-clean-architecture/usecase"
)

type mockFindBalanceAccount struct {
Expand Down
8 changes: 4 additions & 4 deletions adapter/api/action/find_all_account.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package action
import (
"net/http"

"github.com/gsabadini/go-bank-transfer/adapter/api/logging"
"github.com/gsabadini/go-bank-transfer/adapter/api/response"
"github.com/gsabadini/go-bank-transfer/adapter/logger"
"github.com/gsabadini/go-bank-transfer/usecase"
"github.com/gsabadini/go-clean-architecture/adapter/api/logging"
"github.com/gsabadini/go-clean-architecture/adapter/api/response"
"github.com/gsabadini/go-clean-architecture/adapter/logger"
"github.com/gsabadini/go-clean-architecture/usecase"
)

type FindAllAccountAction struct {
Expand Down
4 changes: 2 additions & 2 deletions adapter/api/action/find_all_account_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
"testing"
"time"

"github.com/gsabadini/go-bank-transfer/infrastructure/log"
"github.com/gsabadini/go-bank-transfer/usecase"
"github.com/gsabadini/go-clean-architecture/infrastructure/log"
"github.com/gsabadini/go-clean-architecture/usecase"
)

type mockFindAllAccount struct {
Expand Down
8 changes: 4 additions & 4 deletions adapter/api/action/find_all_transfer.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package action
import (
"net/http"

"github.com/gsabadini/go-bank-transfer/adapter/api/logging"
"github.com/gsabadini/go-bank-transfer/adapter/api/response"
"github.com/gsabadini/go-bank-transfer/adapter/logger"
"github.com/gsabadini/go-bank-transfer/usecase"
"github.com/gsabadini/go-clean-architecture/adapter/api/logging"
"github.com/gsabadini/go-clean-architecture/adapter/api/response"
"github.com/gsabadini/go-clean-architecture/adapter/logger"
"github.com/gsabadini/go-clean-architecture/usecase"
)

type FindAllTransferAction struct {
Expand Down
4 changes: 2 additions & 2 deletions adapter/api/action/find_all_transfer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
"testing"
"time"

"github.com/gsabadini/go-bank-transfer/infrastructure/log"
"github.com/gsabadini/go-bank-transfer/usecase"
"github.com/gsabadini/go-clean-architecture/infrastructure/log"
"github.com/gsabadini/go-clean-architecture/usecase"
)

type mockFindAllTransfer struct {
Expand Down
2 changes: 1 addition & 1 deletion adapter/api/logging/error.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package logging

import (
"github.com/gsabadini/go-bank-transfer/adapter/logger"
"github.com/gsabadini/go-clean-architecture/adapter/logger"
)

type Error struct {
Expand Down
2 changes: 1 addition & 1 deletion adapter/api/logging/info.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package logging

import (
"github.com/gsabadini/go-bank-transfer/adapter/logger"
"github.com/gsabadini/go-clean-architecture/adapter/logger"
)

type Info struct {
Expand Down
8 changes: 2 additions & 6 deletions adapter/api/middleware/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,21 @@ import (
"strings"
"time"

"github.com/gsabadini/go-bank-transfer/adapter/api/logging"
"github.com/gsabadini/go-bank-transfer/adapter/logger"
"github.com/gsabadini/go-clean-architecture/adapter/api/logging"
"github.com/gsabadini/go-clean-architecture/adapter/logger"

"github.com/pkg/errors"
"github.com/urfave/negroni"
)

//Logger armazena a estrutura de log para entrada e saídas da API
type Logger struct {
log logger.Logger
}

//NewLoggerFactory constrói um Logger com suas dependências
func NewLogger(log logger.Logger) Logger {
return Logger{log: log}
}

//Execute cria logs de entrada e saída da API
func (l Logger) Execute(w http.ResponseWriter, r *http.Request, next http.HandlerFunc) {
start := time.Now()

Expand Down Expand Up @@ -76,7 +73,6 @@ func getRequestPayload(r *http.Request) (string, error) {
return "", errors.Wrap(err, "error read body")
}

// re-adiciona o payload ao buffer da request
r.Body = ioutil.NopCloser(bytes.NewBuffer(payload))

return strings.TrimSpace(string(payload)), nil
Expand Down
4 changes: 2 additions & 2 deletions adapter/presenter/create_account.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package presenter
import (
"time"

"github.com/gsabadini/go-bank-transfer/domain"
"github.com/gsabadini/go-bank-transfer/usecase"
"github.com/gsabadini/go-clean-architecture/domain"
"github.com/gsabadini/go-clean-architecture/usecase"
)

type createAccountPresenter struct{}
Expand Down
4 changes: 2 additions & 2 deletions adapter/presenter/create_account_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package presenter

import (
"github.com/gsabadini/go-bank-transfer/domain"
"github.com/gsabadini/go-bank-transfer/usecase"
"github.com/gsabadini/go-clean-architecture/domain"
"github.com/gsabadini/go-clean-architecture/usecase"
"reflect"
"testing"
"time"
Expand Down
4 changes: 2 additions & 2 deletions adapter/presenter/create_transfer.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package presenter
import (
"time"

"github.com/gsabadini/go-bank-transfer/domain"
"github.com/gsabadini/go-bank-transfer/usecase"
"github.com/gsabadini/go-clean-architecture/domain"
"github.com/gsabadini/go-clean-architecture/usecase"
)

type createTransferPresenter struct{}
Expand Down
4 changes: 2 additions & 2 deletions adapter/presenter/create_transfer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"testing"
"time"

"github.com/gsabadini/go-bank-transfer/domain"
"github.com/gsabadini/go-bank-transfer/usecase"
"github.com/gsabadini/go-clean-architecture/domain"
"github.com/gsabadini/go-clean-architecture/usecase"
)

func Test_createTransferPresenter_Output(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions adapter/presenter/find_account_balance.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package presenter

import (
"github.com/gsabadini/go-bank-transfer/domain"
"github.com/gsabadini/go-bank-transfer/usecase"
"github.com/gsabadini/go-clean-architecture/domain"
"github.com/gsabadini/go-clean-architecture/usecase"
)

type findAccountBalancePresenter struct{}
Expand Down
4 changes: 2 additions & 2 deletions adapter/presenter/find_account_balance_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package presenter

import (
"github.com/gsabadini/go-bank-transfer/domain"
"github.com/gsabadini/go-bank-transfer/usecase"
"github.com/gsabadini/go-clean-architecture/domain"
"github.com/gsabadini/go-clean-architecture/usecase"
"reflect"
"testing"
)
Expand Down
4 changes: 2 additions & 2 deletions adapter/presenter/find_all_account.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package presenter
import (
"time"

"github.com/gsabadini/go-bank-transfer/domain"
"github.com/gsabadini/go-bank-transfer/usecase"
"github.com/gsabadini/go-clean-architecture/domain"
"github.com/gsabadini/go-clean-architecture/usecase"
)

type findAllAccountPresenter struct{}
Expand Down
4 changes: 2 additions & 2 deletions adapter/presenter/find_all_account_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"testing"
"time"

"github.com/gsabadini/go-bank-transfer/domain"
"github.com/gsabadini/go-bank-transfer/usecase"
"github.com/gsabadini/go-clean-architecture/domain"
"github.com/gsabadini/go-clean-architecture/usecase"
)

func Test_findAllAccountPresenter_Output(t *testing.T) {
Expand Down
Loading

0 comments on commit d4f84f7

Please sign in to comment.