Overview

hggofmt

This Mercurial extension formats your code using the gofmt command.

Instructions

Enable command hg gofmt with

[extensions]
gofmt = path/to/gofmt.py

Enable automatic precommit formatting on modified go files with

[hooks]
pre-commit.gofmt = python:gofmt.gofmthook
pretxncommit.gofmt = python:gofmt.gofmthook

Example

Here's some unformatted go code

func  add(a,b   int)int{
    return a+b
}

And here's the gofmt'd version

func add(a, b int) int {
    return a + b
}