Prerequisites
Before installing Salt, ensure you have:Go 1.22 or higher
Go 1.22 or higher
Salt requires Go 1.22 or later. Check your version:If you need to install or upgrade Go, visit go.dev/doc/install.
A Go module
A Go module
Your project should be initialized as a Go module:
Install Salt
Add Salt to your project usinggo get:
go.mod file.
Salt uses Go modules for dependency management. The
go get command automatically resolves and installs all required dependencies.Verify installation
Verify that Salt was installed correctly:Import packages
Once installed, you can import any Salt package in your Go code:Available packages
Salt provides the following packages:- Core
- CLI
- Infrastructure
- Authentication
- Utilities
Modular installation
Salt’s modular design means you only download dependencies for packages you actually import. If you only use theconfig and log packages, dependencies for other packages won’t be pulled into your project.
Update Salt
To update to the latest version of Salt:Version pinning
To use a specific version of Salt, specify the version tag:Troubleshooting
Module not found error
Module not found error
If you see a “module not found” error:
- Ensure you have network access to GitHub
- Check that your
GOPRIVATEenvironment variable is configured correctly if using private modules - Run
go clean -modcacheto clear the module cache - Try again with
go get github.com/raystack/salt
Version conflicts
Version conflicts
If you encounter version conflicts with dependencies:
- Run
go mod tidyto clean up your dependencies - Check your
go.modfile for conflicting versions - Use
go mod graphto visualize the dependency tree - Consider updating other dependencies:
go get -u ./...
Import errors
Import errors
If imports aren’t resolving:
- Run
go mod downloadto download all dependencies - Restart your editor/IDE to refresh the Go module cache
- Verify the import path matches the package name exactly
Next steps
Quickstart guide
Now that Salt is installed, follow the quickstart guide to build your first application with config loading and logging.