Merge pull request #9 from moorereason/vet

Cleanups from static analyzers
This commit is contained in:
Adnan Hajdarević 2015-03-19 16:31:24 +01:00
commit 10755eb9d9
2 changed files with 6 additions and 9 deletions

View File

@ -42,12 +42,10 @@ func ExtractParameter(s string, params interface{}) (string, bool) {
return "", false
}
var p []string
if paramsValue := reflect.ValueOf(params); paramsValue.Kind() == reflect.Slice {
if paramsValueSliceLength := paramsValue.Len(); paramsValueSliceLength > 0 {
if p = strings.SplitN(s, ".", 3); len(p) > 3 {
if p := strings.SplitN(s, ".", 3); len(p) > 3 {
index, err := strconv.ParseInt(p[1], 10, 64)
if err != nil {
@ -63,7 +61,7 @@ func ExtractParameter(s string, params interface{}) (string, bool) {
return "", false
}
if p = strings.SplitN(s, ".", 2); len(p) > 1 {
if p := strings.SplitN(s, ".", 2); len(p) > 1 {
if pValue, ok := params.(map[string]interface{})[p[0]]; ok {
return ExtractParameter(p[1], pValue)
}

View File

@ -93,18 +93,17 @@ func main() {
}
}
l := log.New(os.Stdout, "[webhook] ", log.Ldate|log.Ltime)
negroniLogger := &negroni.Logger{l}
l := negroni.NewLogger()
l.Logger = log.New(os.Stdout, "[webhook] ", log.Ldate|log.Ltime)
negroniRecovery := &negroni.Recovery{
Logger: l,
Logger: l.Logger,
PrintStack: true,
StackAll: false,
StackSize: 1024 * 8,
}
n := negroni.New(negroniRecovery, negroniLogger)
n := negroni.New(negroniRecovery, l)
router := mux.NewRouter()