HandlersNames returns a slice of "handlers" names separated by commas. Can be used for debugging or to determinate if end-developer called the same exactly Use/UseRouter/Done... API methods so framework can give a warning.
(handlers ...interface{})
| 167 | // called the same exactly Use/UseRouter/Done... API methods |
| 168 | // so framework can give a warning. |
| 169 | func HandlersNames(handlers ...interface{}) string { |
| 170 | if len(handlers) == 1 { |
| 171 | if hs, ok := handlers[0].(Handlers); ok { |
| 172 | asInterfaces := make([]interface{}, 0, len(hs)) |
| 173 | for _, h := range hs { |
| 174 | asInterfaces = append(asInterfaces, h) |
| 175 | } |
| 176 | |
| 177 | return HandlersNames(asInterfaces...) |
| 178 | } |
| 179 | } |
| 180 | |
| 181 | names := make([]string, 0, len(handlers)) |
| 182 | for _, h := range handlers { |
| 183 | names = append(names, HandlerName(h)) |
| 184 | } |
| 185 | |
| 186 | return strings.Join(names, ",") |
| 187 | } |
| 188 | |
| 189 | // HandlerFileLine returns the handler's file and line information. |
| 190 | // See `context.HandlerFileLine` to get the file, line of the current running handler in the chain. |
nothing calls this directly
no test coverage detected
searching dependent graphs…