From f3dede1e33cd2a6fb9c99e687bafd2eb26f60e86 Mon Sep 17 00:00:00 2001 From: OLUWADAMILOLA OKUSANYA Date: Fri, 24 Nov 2023 21:17:09 -0500 Subject: [PATCH] Moved everything to internal --- .gitignore | 2 ++ cmd/gosimplenpm/conf.go | 2 +- cmd/gosimplenpm/root.go | 4 ++-- {config => internal/config}/conf.go | 0 {handler => internal/handler}/app.go | 4 ++-- {handler => internal/handler}/get.go | 4 ++-- internal/handler/get_test.go | 1 + {handler => internal/handler}/notfound.go | 0 {handler => internal/handler}/publish.go | 6 +++--- {handler => internal/handler}/tagdelete.go | 6 +++--- {handler => internal/handler}/tagget.go | 6 +++--- {handler => internal/handler}/tagput.go | 6 +++--- {handler => internal/handler}/tar.go | 4 ++-- {middlewares => internal/middlewares}/auth.go | 2 +- {middlewares => internal/middlewares}/logRequest.go | 0 {serviceidos => internal/serviceidos}/responseidos.go | 0 {storage => internal/storage}/fs.go | 2 +- 17 files changed, 26 insertions(+), 23 deletions(-) rename {config => internal/config}/conf.go (100%) rename {handler => internal/handler}/app.go (95%) rename {handler => internal/handler}/get.go (92%) create mode 100644 internal/handler/get_test.go rename {handler => internal/handler}/notfound.go (100%) rename {handler => internal/handler}/publish.go (97%) rename {handler => internal/handler}/tagdelete.go (95%) rename {handler => internal/handler}/tagget.go (92%) rename {handler => internal/handler}/tagput.go (95%) rename {handler => internal/handler}/tar.go (95%) rename {middlewares => internal/middlewares}/auth.go (95%) rename {middlewares => internal/middlewares}/logRequest.go (100%) rename {serviceidos => internal/serviceidos}/responseidos.go (100%) rename {storage => internal/storage}/fs.go (99%) diff --git a/.gitignore b/.gitignore index eb6256b..704a057 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ **/userdata/* +examples +tests \ No newline at end of file diff --git a/cmd/gosimplenpm/conf.go b/cmd/gosimplenpm/conf.go index 8760932..0348268 100644 --- a/cmd/gosimplenpm/conf.go +++ b/cmd/gosimplenpm/conf.go @@ -2,7 +2,7 @@ package gosimplenpm import ( "fmt" - "gosimplenpm/config" + "gosimplenpm/internal/config" "os" "github.com/spf13/cobra" diff --git a/cmd/gosimplenpm/root.go b/cmd/gosimplenpm/root.go index 190dd94..25ba6c2 100644 --- a/cmd/gosimplenpm/root.go +++ b/cmd/gosimplenpm/root.go @@ -2,8 +2,8 @@ package gosimplenpm import ( "fmt" - "gosimplenpm/config" - "gosimplenpm/handler" + "gosimplenpm/internal/config" + "gosimplenpm/internal/handler" "os" "github.com/sirupsen/logrus" diff --git a/config/conf.go b/internal/config/conf.go similarity index 100% rename from config/conf.go rename to internal/config/conf.go diff --git a/handler/app.go b/internal/handler/app.go similarity index 95% rename from handler/app.go rename to internal/handler/app.go index 2879a8e..26e43ed 100644 --- a/handler/app.go +++ b/internal/handler/app.go @@ -1,8 +1,8 @@ package handler import ( - "gosimplenpm/config" - "gosimplenpm/middlewares" + "gosimplenpm/internal/config" + "gosimplenpm/internal/middlewares" "net/http" "time" diff --git a/handler/get.go b/internal/handler/get.go similarity index 92% rename from handler/get.go rename to internal/handler/get.go index 649f38c..925aa9e 100644 --- a/handler/get.go +++ b/internal/handler/get.go @@ -8,8 +8,8 @@ import ( "github.com/gorilla/mux" "github.com/sirupsen/logrus" - "gosimplenpm/config" - "gosimplenpm/storage" + "gosimplenpm/internal/config" + "gosimplenpm/internal/storage" ) func GetPackage(lg *logrus.Logger, cfg config.Config) http.HandlerFunc { diff --git a/internal/handler/get_test.go b/internal/handler/get_test.go new file mode 100644 index 0000000..abeebd1 --- /dev/null +++ b/internal/handler/get_test.go @@ -0,0 +1 @@ +package handler diff --git a/handler/notfound.go b/internal/handler/notfound.go similarity index 100% rename from handler/notfound.go rename to internal/handler/notfound.go diff --git a/handler/publish.go b/internal/handler/publish.go similarity index 97% rename from handler/publish.go rename to internal/handler/publish.go index f1626a1..27af380 100644 --- a/handler/publish.go +++ b/internal/handler/publish.go @@ -3,9 +3,9 @@ package handler import ( "encoding/json" "fmt" - "gosimplenpm/config" - "gosimplenpm/serviceidos" - "gosimplenpm/storage" + "gosimplenpm/internal/config" + "gosimplenpm/internal/serviceidos" + "gosimplenpm/internal/storage" "net/http" "net/url" "path" diff --git a/handler/tagdelete.go b/internal/handler/tagdelete.go similarity index 95% rename from handler/tagdelete.go rename to internal/handler/tagdelete.go index b1c2574..f5f06cd 100644 --- a/handler/tagdelete.go +++ b/internal/handler/tagdelete.go @@ -3,9 +3,9 @@ package handler import ( "encoding/json" "fmt" - "gosimplenpm/config" - "gosimplenpm/serviceidos" - "gosimplenpm/storage" + "gosimplenpm/internal/config" + "gosimplenpm/internal/serviceidos" + "gosimplenpm/internal/storage" "net/http" "net/url" "strconv" diff --git a/handler/tagget.go b/internal/handler/tagget.go similarity index 92% rename from handler/tagget.go rename to internal/handler/tagget.go index 5dacdf1..4957334 100644 --- a/handler/tagget.go +++ b/internal/handler/tagget.go @@ -3,9 +3,9 @@ package handler import ( "encoding/json" "fmt" - "gosimplenpm/config" - "gosimplenpm/serviceidos" - "gosimplenpm/storage" + "gosimplenpm/internal/config" + "gosimplenpm/internal/serviceidos" + "gosimplenpm/internal/storage" "net/http" "net/url" "strconv" diff --git a/handler/tagput.go b/internal/handler/tagput.go similarity index 95% rename from handler/tagput.go rename to internal/handler/tagput.go index 0f3aed8..a0fc17b 100644 --- a/handler/tagput.go +++ b/internal/handler/tagput.go @@ -3,9 +3,9 @@ package handler import ( "encoding/json" "fmt" - "gosimplenpm/config" - "gosimplenpm/serviceidos" - "gosimplenpm/storage" + "gosimplenpm/internal/config" + "gosimplenpm/internal/serviceidos" + "gosimplenpm/internal/storage" "io" "net/http" "net/url" diff --git a/handler/tar.go b/internal/handler/tar.go similarity index 95% rename from handler/tar.go rename to internal/handler/tar.go index d7c875b..00c3593 100644 --- a/handler/tar.go +++ b/internal/handler/tar.go @@ -2,8 +2,8 @@ package handler import ( "bytes" - "gosimplenpm/config" - "gosimplenpm/storage" + "gosimplenpm/internal/config" + "gosimplenpm/internal/storage" "io" "net/http" "net/url" diff --git a/middlewares/auth.go b/internal/middlewares/auth.go similarity index 95% rename from middlewares/auth.go rename to internal/middlewares/auth.go index cc3cf91..489003a 100644 --- a/middlewares/auth.go +++ b/internal/middlewares/auth.go @@ -1,7 +1,7 @@ package middlewares import ( - "gosimplenpm/config" + "gosimplenpm/internal/config" "net/http" "strings" ) diff --git a/middlewares/logRequest.go b/internal/middlewares/logRequest.go similarity index 100% rename from middlewares/logRequest.go rename to internal/middlewares/logRequest.go diff --git a/serviceidos/responseidos.go b/internal/serviceidos/responseidos.go similarity index 100% rename from serviceidos/responseidos.go rename to internal/serviceidos/responseidos.go diff --git a/storage/fs.go b/internal/storage/fs.go similarity index 99% rename from storage/fs.go rename to internal/storage/fs.go index 48bf365..4459285 100644 --- a/storage/fs.go +++ b/internal/storage/fs.go @@ -12,7 +12,7 @@ import ( "path" "strings" - "gosimplenpm/serviceidos" + "gosimplenpm/internal/serviceidos" "path/filepath" "github.com/sirupsen/logrus"