Junior — Middle
What third-party libraries do you use in Go development?
sobes.tech AI
Answer from AI
When developing in Go, the following third-party libraries are often used:
- Gin — a high-performance HTTP framework for building web applications and APIs.
- Gorm — an ORM library for working with databases.
- Cobra — for creating CLI applications.
- Viper — for convenient configuration management.
- Logrus or Zap — for structured logging.
- Testify — for advanced testing and mocks.
Example of using Gin:
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() // starts the server on :8080
}