echo.Context undefined (type *echo.Echo has no field or method Context)

Created on 25 Oct 2016  路  2Comments  路  Source: labstack/echo

Description

The code below just gives me an error that it cannot find the echo.Context

Checklist

  • [ X ] Dependencies installed
  • [ X ] No typos
  • [ X ] Searched existing issues and docs

    Expected behaviour

Should just run

Actual behaviour

>> go run echo.go 
# command-line-arguments
./echo.go:18: echo.Context undefined (type *echo.Echo has no field or method Context)

Steps to reproduce

run the code below

Working code to debug

package main
package main

import (
    "log"
    "time"
    "net/http"

    "github.com/labstack/echo"
    "github.com/labstack/echo/engine/fasthttp"
)

func main() {
    echo := echo.New()
    fasthttp_engine := fasthttp.New(":8080")
    fasthttp_engine.ReadTimeout = 2 * time.Second
    fasthttp_engine.WriteTimeout = 2 * time.Second

    echo.GET("/", func(c echo.Context) error {
        //log.Println("Request GET '/'")
        res := []string{"Hello", "World"}
        return c.JSON(http.StatusOK, res)
    })

    log.Println("Starting Server on Port :8080")
    log.Fatal(echo.Run(fasthttp_engine))
}

Version/commit

go 1.7.3

All 2 comments

I found it - doh!

what's the problem?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

neutronstein picture neutronstein  路  3Comments

danieldaeschle picture danieldaeschle  路  3Comments

younisshah picture younisshah  路  4Comments

syntaqx picture syntaqx  路  3Comments

linux-support picture linux-support  路  3Comments