func (c *Context) Next() {
    c.index++
    for c.index < int8(len(c.handlers)) {
        c.handlers[c.index](c)
        c.index++
    }
}

Is it no necessary to call Next() in middleware? if Next() is called once, all the handlers would be called one by one.

if Next function should be explicitly called in each middleware, why does it not use a if statement instead of the "for".

func (c *Context) Next() {
    c.index++
    if c.index < int8(len(c.handlers)) {
        c.handlers[c.index](c)
        c.index++
    }
}

Comment From: hubeoo

I have the same doubts!