remove func.go and standardize main file name

This commit is contained in:
Adrien Marquès 2020-04-04 12:42:18 +02:00
parent 5cadfcf78b
commit 4ba62e19c7
Signed by: xdrm-brackets
GPG Key ID: D75243CA236D825E
3 changed files with 13 additions and 16 deletions

View File

@ -5,6 +5,7 @@ import (
"fmt" "fmt"
"io" "io"
"net/http" "net/http"
"strings"
"git.xdrm.io/go/aicra/datatype" "git.xdrm.io/go/aicra/datatype"
) )
@ -163,3 +164,15 @@ func (server *Server) collide() error {
return nil 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
}

View File

@ -3,7 +3,6 @@ package config
// cerr allows you to create constant "const" error with type boxing. // cerr allows you to create constant "const" error with type boxing.
type cerr string type cerr string
// Error implements the error builtin interface.
func (err cerr) Error() string { func (err cerr) Error() string {
return string(err) return string(err)
} }

View File

@ -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
}