v0.0.0-2019.2 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Jun 24, 2019 License: MIT Imports: 19 Imported by: 0


Keyify turns unkeyed struct literals (T{1, 2, 3}) into keyed ones (T{A: 1, B: 2, C: 3})


See the main README for installation instructions.


Call keyify with a position such as /some/file.go:#5, where #5 is the byte offset in the file and has to point at or into a struct literal.

By default, keyify will print the new literal on stdout, formatted as Go code. By using the -json flag, it will print a JSON object denoting the start and end of the original literal, and its replacement. This is useful for integration with editors.

For a description of all available flags, see keyify -help.


For Emacs integration, add the following to your .emacs file:

(add-to-list 'load-path "/your/gopath/src/
(eval-after-load 'go-mode
  (lambda ()
    (require 'go-keyify)))

With point on or in a struct literal, call the go-keyify command.

gif of keyify



keyify transforms unkeyed struct literals into a keyed ones.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL