From 660ff1a99484a6deadff4bf63993cf2e7bd7884e Mon Sep 17 00:00:00 2001 From: Neur0toxine Date: Tue, 14 Sep 2021 13:04:56 +0300 Subject: [PATCH] refactor app related code to the app package --- cmd/run.go | 6 +++--- internal/{ => app}/handlers.go | 2 +- internal/{ => app}/handlers_test.go | 2 +- internal/{ => app}/router.go | 2 +- internal/{ => app}/signals.go | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) rename internal/{ => app}/handlers.go (94%) rename internal/{ => app}/handlers_test.go (98%) rename internal/{ => app}/router.go (90%) rename internal/{ => app}/signals.go (96%) diff --git a/cmd/run.go b/cmd/run.go index af1d70a..c9d1e2c 100644 --- a/cmd/run.go +++ b/cmd/run.go @@ -4,7 +4,7 @@ import ( "fmt" "time" - "github.com/Neur0toxine/demo-web-service-go/internal" + "github.com/Neur0toxine/demo-web-service-go/internal/app" "github.com/brianvoe/gofakeit/v6" ) @@ -20,8 +20,8 @@ type RunCommand struct{} func (c *RunCommand) Execute(args []string) error { gofakeit.Seed(time.Now().UnixNano()) - go internal.ProcessSignals() - r := internal.Router() + go app.ProcessSignals() + r := app.Router() if err := r.Run(":8080"); err != nil { return fmt.Errorf("cannot start the server on :8080 > %w", err) } diff --git a/internal/handlers.go b/internal/app/handlers.go similarity index 94% rename from internal/handlers.go rename to internal/app/handlers.go index 5a53bca..b1be83f 100644 --- a/internal/handlers.go +++ b/internal/app/handlers.go @@ -1,4 +1,4 @@ -package internal +package app import ( "net/http" diff --git a/internal/handlers_test.go b/internal/app/handlers_test.go similarity index 98% rename from internal/handlers_test.go rename to internal/app/handlers_test.go index 46fa924..f126008 100644 --- a/internal/handlers_test.go +++ b/internal/app/handlers_test.go @@ -1,4 +1,4 @@ -package internal +package app import ( "encoding/json" diff --git a/internal/router.go b/internal/app/router.go similarity index 90% rename from internal/router.go rename to internal/app/router.go index daa4c0f..3dba03a 100644 --- a/internal/router.go +++ b/internal/app/router.go @@ -1,4 +1,4 @@ -package internal +package app import ( "github.com/gin-gonic/gin" diff --git a/internal/signals.go b/internal/app/signals.go similarity index 96% rename from internal/signals.go rename to internal/app/signals.go index 7a54b8c..0a8419a 100644 --- a/internal/signals.go +++ b/internal/app/signals.go @@ -1,4 +1,4 @@ -package internal +package app import ( "log"