How can one call one go program from another

I want to call a go program from another and pass parameters to, and return back to the calling program. I can’t find any documentation on this.

There are several ways to do so. The easiest is probably to use exec.Cmd (exec package - os/exec - pkg.go.dev).

Start the program with its args, and then parse it’s output.

Of course you can also use many other ways of IPC.

Be it dbus, pipes, sockets or network…

It depends on your actual needs which to choose

1 Like

There’s no distinction between calling an executable written in Go or any other language. Do as @NobbZ says.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.