Installation
Requirements
- Go 1.24 or later
- A POSIX shell (macOS, Linux, WSL on Windows)
CLI
The main craftgo binary runs codegen and project commands.
go install github.com/craftgodotdev/craftgo/cmd/craftgo@latestVerify:
craftgo --helpThe binary lands in $GOBIN (or $GOPATH/bin). Make sure that directory is on your PATH.
Language server (optional)
The LSP powers editor features: completion, diagnostics, hover, go-to-definition, formatting.
go install github.com/craftgodotdev/craftgo/cmd/craftgo-lsp@latestThe LSP is invoked by editor extensions. You do not run it directly.
VS Code extension
Install the craftgo extension from the Marketplace — three equivalent ways:
- In VS Code: open the Extensions panel (
Cmd/Ctrl+Shift+X), search craftgo, click Install. - From the command line:
code --install-extension craftgo.craftgo - From the web: the Marketplace listing.
.craftgo files immediately get syntax highlighting, completion, hover, and diagnostics. The extension auto-spawns craftgo-lsp, so install that too (above) for the language-server features.
Build from source instead
git clone https://github.com/craftgodotdev/craftgo
cd craftgo/extensions/vscode
npm install
npm run package
code --install-extension craftgo-*.vsixRuntime library
Add craftgo as a dependency in your project:
go get github.com/craftgodotdev/craftgoGenerated code imports from pkg/server, pkg/log, pkg/metrics, pkg/otel. You do not import these directly in most cases.
Other editors
The LSP speaks standard LSP. Configure your editor to spawn craftgo-lsp for files with extension .craftgo.
Neovim with nvim-lspconfig:
local lspconfig = require('lspconfig')
local configs = require('lspconfig.configs')
if not configs.craftgo then
configs.craftgo = {
default_config = {
cmd = { 'craftgo-lsp' },
filetypes = { 'craftgo' },
root_dir = lspconfig.util.root_pattern('go.mod', '.git'),
},
}
end
lspconfig.craftgo.setup({})Updating
go install github.com/craftgodotdev/craftgo/cmd/craftgo@latest
go install github.com/craftgodotdev/craftgo/cmd/craftgo-lsp@latest
go get -u github.com/craftgodotdev/craftgoAfter updating the LSP binary, restart your editor's language server (in VS Code: Cmd+Shift+P -> craftgo: Restart Language Server).