IMHO //go:generate ... tasks inside a file marked by // +build ignore 
should run. Any file that is marked by // +build ignore will be ignored by 
the compiler. So your code (by putting // +build ignore inside main.go) 
will generate a compilation error.

On Thursday, December 14, 2017 at 2:41:47 PM UTC+3:30, Jan Mercl wrote:
>
> On Thu, Dec 14, 2017 at 11:53 AM dc0d <kaveh.sh...@gmail.com <javascript:>> 
> wrote:
>
> > What is the reasoning for not executing //go:generate ... comments 
> inside a file, that is excluded from build by // +build ignore? 
>
> 'ignore' is just a tag like any other:
>
> $ cat main.go 
> // +build ignore
>
> //go:generate echo foo
>
> package main
>
> func main() {}
> $ go generate
> $ go generate -tags ignore
> foo
> $ 
>
> -- 
>
> -j
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to