gin-gonic/gin

Web Framework
import "github.com/gin-gonic/gin"

A high-performance HTTP web framework written in Go. Fastest Go web framework by benchmarks.

Example

package main

import "github.com/gin-gonic/gin"

func main() {
    r := gin.Default()
    r.GET("/ping", func(c *gin.Context) {
        c.JSON(200, gin.H{"message": "pong"})
    })
    r.Run(":8080")
}

Key Types & Functions

EngineContextRouterGroupHandlerFuncH

About gin-gonic/gin

The gin-gonic/gin package (imported as github.com/gin-gonic/gin) belongs to the Web Framework category of Go packages. A high-performance HTTP web framework written in Go. Fastest Go web framework by benchmarks.

Go's standard library is one of the language's greatest strengths, providing production-ready implementations for networking, cryptography, encoding, I/O, and more. The gin-gonic/gin package follows Go's philosophy of simplicity and composability — small, focused packages that combine through interfaces like io.Reader and io.Writer.

When using gin-gonic/gin in production, follow Go best practices: handle errors explicitly, use context for cancellation and timeouts, prefer composition over inheritance, and write table-driven tests. The Go documentation at pkg.go.dev provides comprehensive API references and examples for every exported type and function.

Related Packages