Skip to content

Homepage Hello World example uses undefined echo.Map with Echo v5 #3065

Description

@narukoshin

The Hello World example on the Echo homepage appears to be outdated for Echo v5.

The homepage currently shows:

package main

import "github.com/labstack/echo/v5"

func main() {
    e := echo.New()
    e.GET("/", func(c *echo.Context) error {
        return c.JSON(200, echo.Map{"message": "Hello, World!"})
    })
    e.Start(":1323")
}

However, echo.Map is not available in Echo v5, so copying this example results in a compilation error.

The Quickstart documentation uses a regular Go map instead:

return c.JSON(http.StatusOK, map[string]string{
    "message": "Hello, World!",
})

Expected behavior

The homepage example should compile when copied using the currently advertised Echo v5 dependency.

Suggested fix

Update the homepage example to match the current v5 Quickstart, or at minimum replace:

echo.Map{"message": "Hello, World!"}

with:

map[string]string{"message": "Hello, World!"}

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions