I would like to run my go file on my input.txt
where my go program will read the input.txt
file when I type in go run command ie:
go run goFile.go input.txt
I don't want to put input.txt
in my goFile.go
code since my go file should run on any input name not just input.txt
.
I try ioutil.ReadAll(os.Stdin)
but I need to change my command to
go run goFile.go < input.txt
I only use package fmt
, os
, bufio
and io/ioutil
. Is it possible to do it without any other packages?