Installation
Installation
Section titled “Installation”Requirements
Section titled “Requirements”- Go 1.21+ - Fox requires Go version 1.21 or higher
- Git - For version control and dependency management
Installing Fox
Section titled “Installing Fox”Using go get
Section titled “Using go get”The simplest way to install Fox is using go get:
go get -u github.com/fox-gonic/foxThis will download Fox and its dependencies, including Gin.
Using Go Modules
Section titled “Using Go Modules”If you’re starting a new project:
# Create a new directorymkdir myprojectcd myproject
# Initialize Go modulego mod init myproject
# Install Foxgo get -u github.com/fox-gonic/foxSpecific Version
Section titled “Specific Version”To install a specific version of Fox:
go get github.com/fox-gonic/fox@v0.1.0Verifying Installation
Section titled “Verifying Installation”Create a simple test file main.go:
package main
import ( "github.com/fox-gonic/fox")
func main() { r := fox.Default() r.GET("/ping", func() string { return "pong" }) r.Run(":8080")}Run it:
go run main.goVisit http://localhost:8080/ping in your browser. You should see “pong”.
Development Tools
Section titled “Development Tools”Recommended Tools
Section titled “Recommended Tools”-
Air - Live reload for Go apps
Terminal window go install github.com/cosmtrek/air@latest -
Delve - Go debugger
Terminal window go install github.com/go-delve/delve/cmd/dlv@latest
IDE Setup
Section titled “IDE Setup”VS Code
Install the Go extension:
- Provides IntelliSense, debugging, and more
- Configure gopls for best experience
GoLand
GoLand has built-in support for Go. Just open your project and you’re ready to go.
Updating Fox
Section titled “Updating Fox”To update to the latest version:
go get -u github.com/fox-gonic/foxgo mod tidyTroubleshooting
Section titled “Troubleshooting”Import Cycle Error
Section titled “Import Cycle Error”If you encounter import cycle errors, ensure your project structure is clean and you’re not creating circular dependencies.
Gin Version Conflicts
Section titled “Gin Version Conflicts”Fox depends on a specific version of Gin. If you have version conflicts:
go mod tidygo clean -modcachego get -u github.com/fox-gonic/foxBuild Errors
Section titled “Build Errors”If you encounter build errors:
- Ensure you’re using Go 1.21+:
go version - Clean your module cache:
go clean -modcache - Re-download dependencies:
go mod download
Next Steps
Section titled “Next Steps”- Quick Start - Build your first Fox application
- Features - Explore Fox’s features