Installation
Set up a new Ginject project from scratch. Covers prerequisites, module initialization, and directory structure.
Installation
Prerequisites
- Go 1.22 or later
- A terminal with
gitavailable
Initialize a New Project
Add Ginject
This installs Ginject and its dependencies (golang.org/x/net for WebSocket support).
Recommended Directory Structure
Verify Installation
Create main.go:
Run it:
You should see Ginject's structured logger output and a server listening on port 3000.
Environment Variables
Ginject's built-in ConfigModule reads .env files. Create one at the project root:
See the Config module docs for typed struct binding.
IDE Support
For best Go editing support, ensure your editor has the Go language server (gopls) installed. No special plugins are needed for Ginject; the framework is plain Go with no code generation.