From 78911ae4e771ae92dfe8e77eb4d49cd0e89bbbbf Mon Sep 17 00:00:00 2001 From: Matt Butcher Date: Tue, 15 Mar 2016 17:17:00 -0600 Subject: [PATCH] fix(manager): add documentation to pos function --- cmd/manager/deployments.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmd/manager/deployments.go b/cmd/manager/deployments.go index c3c7af8fd..9cc403420 100644 --- a/cmd/manager/deployments.go +++ b/cmd/manager/deployments.go @@ -278,6 +278,13 @@ func putDeploymentHandlerFunc(w http.ResponseWriter, r *http.Request) { } } +// pos gets a path item by position. +// +// For example. the path "/foo/bar" has three positions: "" at 0, "foo" at +// 1, and "bar" at 2. +// +// For verb/path combos, position 0 will be the verb: "GET /foo/bar" will have +// "GET " at position 0. func pos(w http.ResponseWriter, r *http.Request, i int) (string, error) { parts := strings.Split(r.URL.Path, "/") if len(parts) < i-1 {