dfx (as a tool) is for a human developer developing a canister, not for a program to use (Golang program in your case, IIUC) to be the client of one that is deployed, as another program. One exception to this is that
dfx may be used by a project in its testing framework, but there are alternatives to doing this as well. It could be used in the way that you are intending, but doing so is not consistent with its intended purpose, and you will be fighting against that fact as you go, and get help.
If you want to become the client of a canister from a Go program, I would advocate writing a small amount of Rust to create a customized CLI tool that your Go program can call, and not use
dfx for this purpose.
As an example,
caniput is a Rust-based CLI tool that is specific to the
I’m advocating that you use that tool/subproject as an example to build a custom tool of your own, much like @stephenandrews is advocating above as well by pointing to the agent libraries in Rust and JS. Indeed,
caniput uses the Rust agent to implement its functionality. It should be straightforward to adapt to another canister’s API.