How to run and pass a command-line-parameter to main.go in GoLand?

Viewed 4819

I am trying to run Go application with IDE GoLand by JetBrains. I just want to run the following command like this:

$ go run main.go service.go

Could you tell me how to configure at "Edit Configuration" panel? I tried to set "Program arguments" but that didn't work.

enter image description here

2 Answers

If you need to specify multiple files to the build configuration, you can either use the "Files" field to add more files to compile or change the "Run Kind" to be "Package" from the current "File" .

The "Program arguments" field is used for arguments to the final program, not to the go tool.

I didn't know it is possible to specify multiple file in "Files" field. After I specified multiple file in "Files" field, then it is work! Thank you so much.

enter image description here

Related