README.md
1Keyify turns unkeyed struct literals (`T{1, 2, 3}`) into keyed
2ones (`T{A: 1, B: 2, C: 3}`)
3
4## Installation
5
6See [the main README](https://github.com/dominikh/go-tools#installation) for installation instructions.
7
8## Usage
9
10Call keyify with a position such as `/some/file.go:#5`, where #5 is
11the byte offset in the file and has to point at or into a struct
12literal.
13
14By default, keyify will print the new literal on stdout, formatted as
15Go code. By using the `-json` flag, it will print a JSON object
16denoting the start and end of the original literal, and its
17replacement. This is useful for integration with editors.
18
19For a description of all available flags, see `keyify -help`.
20
21### Emacs
22
23For Emacs integration, add the following to your `.emacs` file:
24
25```
26(add-to-list 'load-path "/your/gopath/src/honnef.co/go/tools/cmd/keyify)
27(eval-after-load 'go-mode
28 (lambda ()
29 (require 'go-keyify)))
30```
31
32With point on or in a struct literal, call the `go-keyify` command.
33
34![gif of keyify](http://stuff.fork-bomb.org/keyify.gif)
35