Feature Request: Auto-Imports
It would make scripting easier if missing imports for standard libraries are automatically added. I have found the behaviour provided by this tool very helpful while scripting: https://godoc.org/golang.org/x/tools/cmd/goimports . The feature can be optional or only available for an interactive shell. Just an idea.
Neat idea @rjoleary
From what I understand, goimports works on whole files, while gomacro parses and evaluates code line-by-line.
So there's some impedance mismatch that would need to be solved - not too difficult, but not trivial either - it's not something that can be done with a simple call to os/exec.Command()
A contribution would be welcome :)
Update: since the packages in the standard library are basically fixed, goimports behavior is easy to mimic, especially now that gomacro has auto-completion.
It's a good first issue :)
Yeah, this would be really nice. I ran into gomacro via gosnip, a little tool I made to run snippets of Go code on the command line. It uses the AST to figure out which stdlib imports to add automatically (though I might change it to use the library behind goimports, which also adds imports found in GOPATH).