Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to redirect stdin/stdout with go:generate

Tags:

go

I have a tool that acts as a pipe, it reads data from stdin and writes go source code to stdout.

Is it possible to setup input/output redirection and use such tool with go:generate? Something like:

//go:generate tool < file.txt > file.go
like image 642
kostya Avatar asked Aug 21 '15 15:08

kostya


1 Answers

I figured out how to do it:

//go:generate sh -c "tool < file.txt > file.go"
like image 190
kostya Avatar answered Sep 28 '22 05:09

kostya