Say I have a bunch of .txt
files, and a go file fn.go
to read their name. I can type ./fn *.txt
in shell to run fn.go
properly (os.Args
will include a.txt
, b.txt
etc due to shell expansion).
However if I set "Program Arugments" to *.txt
in goland:
then this does not work because goland won't do Shell Expansion to expand *.txt
to a.txt b.txt
which are passed to fn
. Is there a workaroud?
I tried search the internet,but no luck
You may want to use
os.ReadDir()
function not to pass all these files as command-line arguments: