linter issue fixes

This commit is contained in:
dmitrijgulacenkov committed 2020-09-28 14:53:32 +03:00
1 parent 2f09c32d88
commit c46003d882
2 files changed
+12 -13

No files matched your search

+11 -12
View File
@@ -73,7 +73,7 @@ func InitProxies(locations []conf.Location) (map[string]func([]structure.Address
}
func InitProxiesFromConfigs(configs structure.RoutingConfig) error {
for _, config := range configs {
for _, config := range configs { //nolint
ip := config.Address.IP
for protocol, info := range config.HandlersInfo {
@@ -98,7 +98,7 @@ func InitProxiesFromConfigs(configs structure.RoutingConfig) error {
}
func getPathsFromEndpoints(endpoints []structure.EndpointDescriptor) []string {
var paths []string
paths := make([]string, len(endpoints))
for _, endpoint := range endpoints {
paths = append(paths, endpoint.Path)
}
@@ -125,20 +125,19 @@ func makeProxy(protocol string, skipAuth, skipExistCheck bool) (Proxy, error) {
func Find(path string) (Proxy, string) {
for _, item := range store {
if item.pathPrefix == "" {
for _, iPath := range item.paths {
if path == iPath {
return item.proxy, path
}
if path == "/"+iPath {
return item.proxy, path[1:]
}
}
} else {
if item.pathPrefix != "" {
if strings.HasPrefix(path, item.pathPrefix) {
return item.proxy, getPathWithoutPrefix(path, item.pathPrefix)
}
}
for _, iPath := range item.paths {
if path == iPath {
return item.proxy, path
}
if path == "/"+iPath {
return item.proxy, path[1:]
}
}
}
return nil, ""
}
+1 -1
View File
@@ -37,7 +37,7 @@ func InitRoutes(configs structure.RoutingConfig) {
AuthUserMethods = newAuthUserAddressMap
}
func addEndpointsToMaps(endpoints []structure.EndpointDescriptor, newAddressMap map[string]bool, newInnerAddressMap map[string]bool, newAuthUserAddressMap map[string]bool) {
func addEndpointsToMaps(endpoints []structure.EndpointDescriptor, newAddressMap map[string]bool, newInnerAddressMap map[string]bool, newAuthUserAddressMap map[string]bool) { //nolint
for _, el := range endpoints {
newAddressMap[el.Path] = true
if el.Inner {