Re: [go-nuts] goimports flag parity with gofmt

2017-12-17 Thread Brad Fitzpatrick
I'd still rather not. But it'd be more than one change anyway. We're not just going to copy/paste the code from gofmt into goimports if it did happen. We'd want to move the simplify code to an x/* package (either https://godoc.org/golang.org/x/tools/go/ast/astutil or a subdirectory thereof) and th

Re: [go-nuts] goimports flag parity with gofmt

2017-12-17 Thread ramyanexus
Brad, Would you be open to consider a PR to add the "-s" flag support to goimports? On Monday, June 12, 2017 at 9:56:06 AM UTC-7, bradfitz wrote: > > Use the tool that does what you want. > > We don't have to put all functionality into all binaries. > > If vim-go makes assumptions that one helpe

Re: [go-nuts] goimports flag parity with gofmt

2017-06-13 Thread 'Sergiy Byelozyorov' via golang-nuts
Ah. Good point. Added autocmd BufWritePre *.go :GoFmt autocmd BufWritePre *.go :GoImports to my .vimrc. Thanks. On Tue, Jun 13, 2017 at 3:38 PM Fatih Arslan wrote: > No you can do it. We have two commands, called :GoImports and :GoFmt. You > can set the new setting and then call first :GoImpor

Re: [go-nuts] goimports flag parity with gofmt

2017-06-13 Thread Fatih Arslan
No you can do it. We have two commands, called :GoImports and :GoFmt. You can set the new setting and then call first :GoImports and then :GoFmt. With a little vim script you could create a single command that executes them in order. On Tue, Jun 13, 2017 at 4:07 PM Sergiy Byelozyorov wrote: > Ye

Re: [go-nuts] goimports flag parity with gofmt

2017-06-13 Thread 'Sergiy Byelozyorov' via golang-nuts
Yes, but what I need is to run "goimports" and then "gofmt -s". If goimports supported -s, then I would be able to do what I need, but not with current vim-go implementation. On Tue, Jun 13, 2017 at 3:00 PM Fatih Arslan wrote: > I think there is a misunderstanding here. People somehow don't read

Re: [go-nuts] goimports flag parity with gofmt

2017-06-13 Thread Fatih Arslan
I think there is a misunderstanding here. People somehow don't read the manuals or the changelog when I release a new version. We have the following setting for (which was released recently with v1.13): let g:go_fmt_options = { \ 'gofmt': '-s', \ 'goimports': '-local mycompany.com',

Re: [go-nuts] goimports flag parity with gofmt

2017-06-12 Thread Brad Fitzpatrick
Fixed: https://golang.org/cl/45390 On Mon, Jun 12, 2017 at 10:09 AM, Chandru wrote: > The documentation of goimports[1] says, > > It's a drop-in replacement for your editor's gofmt-on-save hook. "It has > the same command-line interface as gofmt" and formats your code in the same > way. (quotes

Re: [go-nuts] goimports flag parity with gofmt

2017-06-12 Thread Chandru
The documentation of goimports[1] says, It's a drop-in replacement for your editor's gofmt-on-save hook. "It has the same command-line interface as gofmt" and formats your code in the same way. (quotes are mine) I think this documentation needs fixing too? [1]: https://godoc.org/golang.org/x/too

Re: [go-nuts] goimports flag parity with gofmt

2017-06-12 Thread Brad Fitzpatrick
Use the tool that does what you want. We don't have to put all functionality into all binaries. If vim-go makes assumptions that one helper binary does all functionality, yes, please fix vim-go. On Mon, Jun 12, 2017 at 9:12 AM, sergiyb via golang-nuts < golang-nuts@googlegroups.com> wrote: > Th

Re: [go-nuts] goimports flag parity with gofmt

2017-06-12 Thread sergiyb via golang-nuts
This is still bothering us in 2017. I'd love to be able to run goimports on save in Vim, but also would like to simplify code (-s option). I use vim-go plugin, so I guess I can submit a pull request asking the plugin to run both commands on save, but I do not understand why the workaround instea