Re: [go-nuts] how to pass analyzer's flag with 'go vet -vettool'

2021-04-14 Thread 'wagner riffel' via golang-nuts
On Wed Apr 14, 2021 at 12:25 AM -03, Xiangdong Ji wrote:
> I tried to modify fieldalignment to turn its '-fix' option on by
> default, change worked as expected if running fieldalignment as a
> standalone utility, but no rewriting is applied when running it as a
> tool of 'go vet', could any expert here shed a light? Thanks.
>

In the last time I check this, I remember I saw that `go vet` calls
`vettol` with -flags argument and then tries to match with the command
line passed, but fieldalignment doesn't list -fix, that's why I said it
was broken. Hope this might help you:
https://github.com/golang/go/blob/e22478/src/cmd/go/internal/vet/vetflag.go#L67

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CANHTHBOHYT7.2C1Y5NKICHA8%40pampas.


Re: [go-nuts] how to pass analyzer's flag with 'go vet -vettool'

2021-04-13 Thread Xiangdong Ji
Thanks Wagner.

I concur that there might be a bug, or at least the documentation could 
CLARIFY whether analyzer's option is not supported or not,
referring to the usage of 'go vet' I assume the answer would be 'no'.

I tried to modify fieldalignment to turn its '-fix' option on by default, 
change worked as expected if running fieldalignment as a standalone
utility, but no rewriting is applied when running it as a tool of 'go vet', 
could any expert here shed a light? Thanks.  

On Tuesday, April 13, 2021 at 9:50:16 AM UTC+8 wagner riffel wrote:

> On Mon Apr 12, 2021 at 10:23 AM -03, Xiangdong Ji wrote:
> > Hi,
> >
> > I'm trying to run "go vet -vettool=$(which fieldalignment) ./..." for a
> > large project, and wish to turn its '-fix' option on, wondering how to
> > pass
> > that option?
>
> Hi Xiangdong, I found that surprising that even docs didn't mention
> this anywhere, I also got confused by how go vet -vettool works but I
> think I understood after reading the source code, after a -vettool is
> specified, all flags that are not build flags should be sent to the
> vettool, apparently those old tools like fieldalignemnt are broken
> with the new "vet command line protocol" mentioned in the source code,
> even some flags for those tools is broken, it's clear to me that
> there's a bug going on here. Please also consider that possible that I
> just think I understood the problem. :)
>
> BR.
>
> --wagner
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/ddc5863d-cf77-4015-91f1-b1cae4863ed8n%40googlegroups.com.


Re: [go-nuts] how to pass analyzer's flag with 'go vet -vettool'

2021-04-12 Thread 'wagner riffel' via golang-nuts
On Mon Apr 12, 2021 at 10:23 AM -03, Xiangdong Ji wrote:
> Hi,
>
> I'm trying to run "go vet -vettool=$(which fieldalignment) ./..." for a
> large project, and wish to turn its '-fix' option on, wondering how to
> pass
> that option?

Hi Xiangdong, I found that surprising that even docs didn't mention
this anywhere, I also got confused by how go vet -vettool works but I
think I understood after reading the source code, after a -vettool is
specified, all flags that are not build flags should be sent to the
vettool, apparently those old tools like fieldalignemnt are broken
with the new "vet command line protocol" mentioned in the source code,
even some flags for those tools is broken, it's clear to me that
there's a bug going on here. Please also consider that possible that I
just think I understood the problem. :)

BR.

--wagner

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAM7VOPMQSL3.12A9D1RI2IO7S%40pampas.