From 4ba62e19c76d1e34f8ba70da660030e801a8a26f Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Sat, 4 Apr 2020 12:42:18 +0200 Subject: [PATCH] remove func.go and standardize main file name --- internal/config/{server.go => config.go} | 13 +++++++++++++ internal/config/errors.go | 1 - internal/config/func.go | 15 --------------- 3 files changed, 13 insertions(+), 16 deletions(-) rename internal/config/{server.go => config.go} (94%) delete mode 100644 internal/config/func.go diff --git a/internal/config/server.go b/internal/config/config.go similarity index 94% rename from internal/config/server.go rename to internal/config/config.go index 192d98d..55089bb 100644 --- a/internal/config/server.go +++ b/internal/config/config.go @@ -5,6 +5,7 @@ import ( "fmt" "io" "net/http" + "strings" "git.xdrm.io/go/aicra/datatype" ) @@ -163,3 +164,15 @@ func (server *Server) collide() error { return nil } + +// SplitURL without empty sets +func SplitURL(url string) []string { + trimmed := strings.Trim(url, " /\t\r\n") + split := strings.Split(trimmed, "/") + + // remove empty set when empty url + if len(split) == 1 && len(split[0]) == 0 { + return []string{} + } + return split +} diff --git a/internal/config/errors.go b/internal/config/errors.go index 2a2df17..9e2cf17 100644 --- a/internal/config/errors.go +++ b/internal/config/errors.go @@ -3,7 +3,6 @@ package config // cerr allows you to create constant "const" error with type boxing. type cerr string -// Error implements the error builtin interface. func (err cerr) Error() string { return string(err) } diff --git a/internal/config/func.go b/internal/config/func.go deleted file mode 100644 index 674030c..0000000 --- a/internal/config/func.go +++ /dev/null @@ -1,15 +0,0 @@ -package config - -import "strings" - -// SplitURL without empty sets -func SplitURL(url string) []string { - trimmed := strings.Trim(url, " /\t\r\n") - split := strings.Split(trimmed, "/") - - // remove empty set when empty url - if len(split) == 1 && len(split[0]) == 0 { - return []string{} - } - return split -}