You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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()
Update: since the packages in the standard library are basically fixed, goimports behavior is easy to mimic, especially now that gomacro has auto-completion.
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).
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.
The text was updated successfully, but these errors were encountered: