Skip to content

jbrudvik/nova-go-formatter.novaextension

Repository files navigation

Go Formatter for Nova

Go Formatter formats Go code using goimports or gofmt.

Build

There are three ways to run Go Formatter:

  • On save: When a Go file is saved, it will automatically be formatted
  • Menu item: Select the Editor → Format Go code menu item
  • Command palette: Open the command palette and type Format Go code

Using goimports

To use goimports, it must be installed and visible in your environment (e.g., on your PATH variable). goimports can be installed with this shell command:

$ go install golang.org/x/tools/cmd/goimports@latest

Using gofmt

To use gofmt:

  1. Uncheck the "Use goimports if available" extension preference
  2. Ensure gofmt is installed (included with the official Go installer) and visible in your environment (e.g., on your PATH variable)

Issues

If Go Formatter fails to run, error messages will be shown as a Nova notification. If you run into an issue that you think Go Formatter should handle, please submit a bug report.

Installing

Go Formatter at Nova's Extension Library

Or, install using Nova by selecting Extensions → Extension Library..., searching for Go Formatter, and clicking the Install button.