|
@@ -103,7 +103,7 @@ func parseAccept(acceptHeader string) []string {
|
|
|
if index := strings.IndexByte(part, ';'); index >= 0 {
|
|
if index := strings.IndexByte(part, ';'); index >= 0 {
|
|
|
part = part[0:index]
|
|
part = part[0:index]
|
|
|
}
|
|
}
|
|
|
- if part = strings.TrimSpace(part); len(part) > 0 {
|
|
|
|
|
|
|
+ if part = strings.TrimSpace(part); part != "" {
|
|
|
out = append(out, part)
|
|
out = append(out, part)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -111,11 +111,10 @@ func parseAccept(acceptHeader string) []string {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func lastChar(str string) uint8 {
|
|
func lastChar(str string) uint8 {
|
|
|
- size := len(str)
|
|
|
|
|
- if size == 0 {
|
|
|
|
|
|
|
+ if str == "" {
|
|
|
panic("The length of the string can't be 0")
|
|
panic("The length of the string can't be 0")
|
|
|
}
|
|
}
|
|
|
- return str[size-1]
|
|
|
|
|
|
|
+ return str[len(str)-1]
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func nameOfFunction(f interface{}) string {
|
|
func nameOfFunction(f interface{}) string {
|
|
@@ -123,7 +122,7 @@ func nameOfFunction(f interface{}) string {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func joinPaths(absolutePath, relativePath string) string {
|
|
func joinPaths(absolutePath, relativePath string) string {
|
|
|
- if len(relativePath) == 0 {
|
|
|
|
|
|
|
+ if relativePath == "" {
|
|
|
return absolutePath
|
|
return absolutePath
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -138,7 +137,7 @@ func joinPaths(absolutePath, relativePath string) string {
|
|
|
func resolveAddress(addr []string) string {
|
|
func resolveAddress(addr []string) string {
|
|
|
switch len(addr) {
|
|
switch len(addr) {
|
|
|
case 0:
|
|
case 0:
|
|
|
- if port := os.Getenv("PORT"); len(port) > 0 {
|
|
|
|
|
|
|
+ if port := os.Getenv("PORT"); port != "" {
|
|
|
debugPrint("Environment variable PORT=\"%s\"", port)
|
|
debugPrint("Environment variable PORT=\"%s\"", port)
|
|
|
return ":" + port
|
|
return ":" + port
|
|
|
}
|
|
}
|