panic: `slice bounds out of range [:2] with capacity 1` with test files
The files are the ones of the test directory in the menshen repo. To reproduce:
go run ./cmd/menshen/main.go --verbose --from-eip-file test/eip-service.json --allow-bridge-list --allow-gateway-list --client-cert-url http://localhost:8443/api/5/openvpn/cert --ca-file test/ca.crt --ovpn-ca-crt test/ovpn_client_ca.
crt --ovpn-ca-key test/ovpn_client_ca.key
...
pea@peabox:pkg curl localhost:8443/api/5/gateways
curl: (52) Empty reply from server
⇨ http server started on [::]:8443
echo: http: panic serving [::1]:53160: runtime error: slice bounds out of range [:2] with capacity 1
goroutine 37 [running]:
net/http.(*conn).serve.func1()
/usr/lib/go/src/net/http/server.go:1898 +0xbe
panic({0xf0aa60?, 0xc00003a2e8?})
/usr/lib/go/src/runtime/panic.go:770 +0x132
0xacab.org/leap/menshen/pkg/geolocate.PickBestLocations(0xc002637688?, {0x0, 0x0}, {0xc0000663f0, 0x1, 0x1})
/home/kmille/projects/leap/menshen/pkg/geolocate/distance.go:40 +0x509
0xacab.org/leap/menshen/pkg/api.(*registry).ListAllGateways(0xc000180480, {0x1952df0, 0xc00023a820})
/home/kmille/projects/leap/menshen/pkg/api/gateway.go:90 +0x43c
github.com/labstack/echo/v4.(*Echo).add.func1({0x1952df0, 0xc00023a820})
/home/kmille/go/pkg/mod/github.com/labstack/echo/v4@v4.11.1/echo.go:582 +0x4b
github.com/labstack/echo/v4/middleware.LoggerWithConfig.func2.1({0x1952df0, 0xc00023a820})
/home/kmille/go/pkg/mod/github.com/labstack/echo/v4@v4.11.1/middleware/logger.go:126 +0xd8
0xacab.org/leap/menshen/pkg/api.authTokenMiddleware.func1({0x1952df0, 0xc00023a820})
/home/kmille/projects/leap/menshen/pkg/api/auth.go:38 +0x2f2
0xacab.org/leap/menshen/pkg/api.InitServer.storageMiddleware.func3.1({0x1952df0, 0xc00023a820})
/home/kmille/projects/leap/menshen/pkg/api/storage.go:14 +0x59
github.com/labstack/echo/v4.(*Echo).ServeHTTP(0xc0001446c8, {0x1940530, 0xc000022000}, 0xc000198000)
/home/kmille/go/pkg/mod/github.com/labstack/echo/v4@v4.11.1/echo.go:669 +0x327
net/http.serverHandler.ServeHTTP({0xc000173530?}, {0x1940530?, 0xc000022000?}, 0x6?)
/usr/lib/go/src/net/http/server.go:3137 +0x8e
net/http.(*conn).serve(0xc000142120, {0x19423c8, 0xc0001e0240})
/usr/lib/go/src/net/http/server.go:2039 +0x5e8
created by net/http.(*Server).Serve in goroutine 1
/usr/lib/go/src/net/http/server.go:3285 +0x4b4