From b385072712337312e758bb95fb40d953ee73308c Mon Sep 17 00:00:00 2001 From: Caio Teixeira Date: Mon, 20 May 2024 09:38:58 -0300 Subject: [PATCH] fix: module name (#11) What Rename the module to follow Go mod recommendations. > The module's module path, usually the repository location from which the module can be downloaded by Go tools Why Follow the best practices. --- cmd/serve.go | 2 +- go.mod | 2 +- internal/data/models.go | 3 ++- internal/data/payments.go | 2 +- internal/data/payments_test.go | 4 ++-- internal/db/dbtest/dbtest.go | 2 +- internal/serve/httphandler/payments_handler.go | 4 ++-- internal/serve/httphandler/payments_handler_test.go | 7 +++---- internal/serve/serve.go | 9 ++++----- main.go | 2 +- 10 files changed, 18 insertions(+), 19 deletions(-) diff --git a/cmd/serve.go b/cmd/serve.go index d47d361..0211c46 100644 --- a/cmd/serve.go +++ b/cmd/serve.go @@ -2,12 +2,12 @@ package cmd import ( "go/types" - "wallet-backend/internal/serve" _ "github.com/lib/pq" "github.com/spf13/cobra" "github.com/stellar/go/support/config" supportlog "github.com/stellar/go/support/log" + "github.com/stellar/wallet-backend/internal/serve" ) type serveCmd struct { diff --git a/go.mod b/go.mod index 84853f5..6893492 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module wallet-backend +module github.com/stellar/wallet-backend go 1.22.0 diff --git a/internal/data/models.go b/internal/data/models.go index 2b50087..2da7db6 100644 --- a/internal/data/models.go +++ b/internal/data/models.go @@ -2,7 +2,8 @@ package data import ( "errors" - "wallet-backend/internal/db" + + "github.com/stellar/wallet-backend/internal/db" ) type Models struct { diff --git a/internal/data/payments.go b/internal/data/payments.go index b8d982c..2a60c55 100644 --- a/internal/data/payments.go +++ b/internal/data/payments.go @@ -2,9 +2,9 @@ package data import ( "context" - "wallet-backend/internal/db" "github.com/stellar/go/support/errors" + "github.com/stellar/wallet-backend/internal/db" ) type PaymentModel struct { diff --git a/internal/data/payments_test.go b/internal/data/payments_test.go index cf6c683..dd7a44b 100644 --- a/internal/data/payments_test.go +++ b/internal/data/payments_test.go @@ -4,10 +4,10 @@ import ( "context" "database/sql" "testing" - "wallet-backend/internal/db" - "wallet-backend/internal/db/dbtest" "github.com/stellar/go/keypair" + "github.com/stellar/wallet-backend/internal/db" + "github.com/stellar/wallet-backend/internal/db/dbtest" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/internal/db/dbtest/dbtest.go b/internal/db/dbtest/dbtest.go index da4b687..ccf8820 100644 --- a/internal/db/dbtest/dbtest.go +++ b/internal/db/dbtest/dbtest.go @@ -3,11 +3,11 @@ package dbtest import ( "net/http" "testing" - "wallet-backend/internal/db/migrations" migrate "github.com/rubenv/sql-migrate" "github.com/stellar/go/support/db/dbtest" "github.com/stellar/go/support/db/schema" + "github.com/stellar/wallet-backend/internal/db/migrations" ) func Open(t *testing.T) *dbtest.DB { diff --git a/internal/serve/httphandler/payments_handler.go b/internal/serve/httphandler/payments_handler.go index 7d1c2ca..89dd452 100644 --- a/internal/serve/httphandler/payments_handler.go +++ b/internal/serve/httphandler/payments_handler.go @@ -2,10 +2,10 @@ package httphandler import ( "net/http" - "wallet-backend/internal/data" - "wallet-backend/internal/serve/httperror" "github.com/stellar/go/support/http/httpdecode" + "github.com/stellar/wallet-backend/internal/data" + "github.com/stellar/wallet-backend/internal/serve/httperror" ) type PaymentsHandler struct { diff --git a/internal/serve/httphandler/payments_handler_test.go b/internal/serve/httphandler/payments_handler_test.go index d02358e..4c97fa7 100644 --- a/internal/serve/httphandler/payments_handler_test.go +++ b/internal/serve/httphandler/payments_handler_test.go @@ -8,13 +8,12 @@ import ( "net/http/httptest" "strings" "testing" - "wallet-backend/internal/data" - "wallet-backend/internal/db/dbtest" - - "wallet-backend/internal/db" "github.com/go-chi/chi" "github.com/stellar/go/keypair" + "github.com/stellar/wallet-backend/internal/data" + "github.com/stellar/wallet-backend/internal/db" + "github.com/stellar/wallet-backend/internal/db/dbtest" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/internal/serve/serve.go b/internal/serve/serve.go index 46b6e08..eac8043 100644 --- a/internal/serve/serve.go +++ b/internal/serve/serve.go @@ -4,16 +4,15 @@ import ( "fmt" "net/http" - "wallet-backend/internal/data" - "wallet-backend/internal/db" - "wallet-backend/internal/serve/httperror" - "wallet-backend/internal/serve/httphandler" - "github.com/go-chi/chi" "github.com/pkg/errors" supporthttp "github.com/stellar/go/support/http" supportlog "github.com/stellar/go/support/log" "github.com/stellar/go/support/render/health" + "github.com/stellar/wallet-backend/internal/data" + "github.com/stellar/wallet-backend/internal/db" + "github.com/stellar/wallet-backend/internal/serve/httperror" + "github.com/stellar/wallet-backend/internal/serve/httphandler" ) type Configs struct { diff --git a/main.go b/main.go index 3a7fdd2..646ab75 100644 --- a/main.go +++ b/main.go @@ -1,6 +1,6 @@ package main -import "wallet-backend/cmd" +import "github.com/stellar/wallet-backend/cmd" func main() { cmd.Execute()