diff --git a/cmd/migrate.go b/cmd/migrate.go index 4087ba4..f282a70 100644 --- a/cmd/migrate.go +++ b/cmd/migrate.go @@ -8,8 +8,8 @@ import ( "github.com/sirupsen/logrus" "github.com/spf13/cobra" - "github.com/weesvc/weesvc-gorilla/app" - "github.com/weesvc/weesvc-gorilla/migrations" + "github.com/weesvc/weesvc-gorilla/internal/app" + "github.com/weesvc/weesvc-gorilla/internal/migrations" ) var migrateCmd = &cobra.Command{ diff --git a/cmd/serve.go b/cmd/serve.go index 2aa09b7..37e07b9 100644 --- a/cmd/serve.go +++ b/cmd/serve.go @@ -14,8 +14,8 @@ import ( "github.com/sirupsen/logrus" "github.com/spf13/cobra" - "github.com/weesvc/weesvc-gorilla/api" - "github.com/weesvc/weesvc-gorilla/app" + "github.com/weesvc/weesvc-gorilla/internal/api" + "github.com/weesvc/weesvc-gorilla/internal/app" ) func serveAPI(ctx context.Context, api *api.API) { diff --git a/cmd/version.go b/cmd/version.go index 47401c5..17b6322 100644 --- a/cmd/version.go +++ b/cmd/version.go @@ -5,7 +5,7 @@ import ( "github.com/spf13/cobra" - "github.com/weesvc/weesvc-gorilla/env" + "github.com/weesvc/weesvc-gorilla/internal/env" ) var versionCmd = &cobra.Command{ diff --git a/api/api.go b/internal/api/api.go similarity index 98% rename from api/api.go rename to internal/api/api.go index e603525..26534fb 100644 --- a/api/api.go +++ b/internal/api/api.go @@ -15,7 +15,7 @@ import ( "github.com/gorilla/mux" "github.com/sirupsen/logrus" - "github.com/weesvc/weesvc-gorilla/app" + "github.com/weesvc/weesvc-gorilla/internal/app" ) type statusCodeRecorder struct { diff --git a/api/api_contract_test.go b/internal/api/api_contract_test.go similarity index 100% rename from api/api_contract_test.go rename to internal/api/api_contract_test.go diff --git a/api/api_test.go b/internal/api/api_test.go similarity index 100% rename from api/api_test.go rename to internal/api/api_test.go diff --git a/api/config.go b/internal/api/config.go similarity index 100% rename from api/config.go rename to internal/api/config.go diff --git a/api/place.go b/internal/api/place.go similarity index 97% rename from api/place.go rename to internal/api/place.go index cd87c48..ebe40fb 100644 --- a/api/place.go +++ b/internal/api/place.go @@ -9,8 +9,8 @@ import ( "github.com/gorilla/mux" - "github.com/weesvc/weesvc-gorilla/app" - "github.com/weesvc/weesvc-gorilla/model" + "github.com/weesvc/weesvc-gorilla/internal/app" + "github.com/weesvc/weesvc-gorilla/internal/model" ) func (a *API) getPlaces(ctx *app.Context, w http.ResponseWriter, _ *http.Request) error { diff --git a/app/app.go b/internal/app/app.go similarity index 96% rename from app/app.go rename to internal/app/app.go index 05f5acb..55279d4 100644 --- a/app/app.go +++ b/internal/app/app.go @@ -4,7 +4,7 @@ package app import ( "github.com/sirupsen/logrus" - "github.com/weesvc/weesvc-gorilla/db" + "github.com/weesvc/weesvc-gorilla/internal/db" ) // App defines the main application state and behaviors. diff --git a/app/context.go b/internal/app/context.go similarity index 94% rename from app/context.go rename to internal/app/context.go index a221acf..99088a0 100644 --- a/app/context.go +++ b/internal/app/context.go @@ -4,7 +4,7 @@ import ( "github.com/google/uuid" "github.com/sirupsen/logrus" - "github.com/weesvc/weesvc-gorilla/db" + "github.com/weesvc/weesvc-gorilla/internal/db" ) // Context provides for a request-scoped context. diff --git a/app/place.go b/internal/app/place.go similarity index 95% rename from app/place.go rename to internal/app/place.go index f4736b0..bb73564 100644 --- a/app/place.go +++ b/internal/app/place.go @@ -1,6 +1,8 @@ package app -import "github.com/weesvc/weesvc-gorilla/model" +import ( + "github.com/weesvc/weesvc-gorilla/internal/model" +) // GetPlaces returns available places. func (ctx *Context) GetPlaces() ([]*model.Place, error) { diff --git a/db/config.go b/internal/db/config.go similarity index 100% rename from db/config.go rename to internal/db/config.go diff --git a/db/db.go b/internal/db/db.go similarity index 100% rename from db/db.go rename to internal/db/db.go diff --git a/db/place.go b/internal/db/place.go similarity index 95% rename from db/place.go rename to internal/db/place.go index 905ef4e..4b474e4 100644 --- a/db/place.go +++ b/internal/db/place.go @@ -3,7 +3,7 @@ package db import ( "github.com/pkg/errors" - "github.com/weesvc/weesvc-gorilla/model" + "github.com/weesvc/weesvc-gorilla/internal/model" ) // GetPlaces retrieves all available places from the database. diff --git a/db/place_test.go b/internal/db/place_test.go similarity index 98% rename from db/place_test.go rename to internal/db/place_test.go index 6dec857..6cb0981 100644 --- a/db/place_test.go +++ b/internal/db/place_test.go @@ -5,7 +5,8 @@ import ( "log" "testing" - "github.com/weesvc/weesvc-gorilla/model" + "github.com/weesvc/weesvc-gorilla/internal/model" + "github.com/weesvc/weesvc-gorilla/testhelpers" "github.com/stretchr/testify/assert" diff --git a/env/version.go b/internal/env/version.go similarity index 100% rename from env/version.go rename to internal/env/version.go diff --git a/migrations/0001_create_places.go b/internal/migrations/0001_create_places.go similarity index 100% rename from migrations/0001_create_places.go rename to internal/migrations/0001_create_places.go diff --git a/migrations/migrate.go b/internal/migrations/migrate.go similarity index 100% rename from migrations/migrate.go rename to internal/migrations/migrate.go diff --git a/model/place.go b/internal/model/place.go similarity index 100% rename from model/place.go rename to internal/model/place.go diff --git a/testhelpers/containers.go b/testhelpers/containers.go index bf9b94a..c9c931d 100644 --- a/testhelpers/containers.go +++ b/testhelpers/containers.go @@ -23,7 +23,7 @@ type PostgresContainer struct { func CreatePostgresContainer(ctx context.Context) (*PostgresContainer, error) { pgContainer, err := postgres.RunContainer(ctx, testcontainers.WithImage("postgres:15.3-alpine"), - postgres.WithInitScripts(filepath.Join("..", "testdata", "init-db.sql")), + postgres.WithInitScripts(filepath.Join("..", "..", "testdata", "init-db.sql")), postgres.WithDatabase("test-db"), postgres.WithUsername("postgres"), postgres.WithPassword("postgres"),