ast transformation seems a good candidate for your problem.

Should not be very difficult.

start with 
https://godoc.org/golang.org/x/tools/go/loader

Learn ast struct with 
https://golang.org/pkg/go/ast/#Print
might be helpful 
https://gist.github.com/mh-cbon/3ed5d9c39e9635cfed0f896000098133

Also i think go has already several patchers that you might get inspiration 
from,
not sure where they are located. Sorry : x

On Tuesday, May 9, 2017 at 2:01:19 AM UTC+2, Tong Sun wrote:
>
> I know using of builtin print is not encouraged, but it's convenient, and 
> I've sprinted it all over my code. 
>
> Now debugging is over, I need to disable all the builtin prints. Is there 
> any easy way to toggle the printing on and off, so that I can enable 
> debugging any time in the future? I've tried many ways, but seems 
> commenting them off is the only way I can find. 
>
> Please help. 
>

-- 
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