The goal of this PR is to allow full customization of the client.Config (including its Socket, BaseURL and UserAgent members) for callers of cli.Run(). This is achieved by adding a RunOptions struct as argument to cli.Run().
The clientConfig global variable isn't accessed by any non-test code, so it can be removed.
Additional information about test-related changes:
The global variable WAS used in tests (as ClientConfig, in internals/cli/cli_test.go: cli.ClientConfig.BaseURL = server.URL), but since all tests use cli.RunMain() (which is defined in cli/export_test.go) instead of cli.Run(), we can just define the global variable for the tests only, and make RunMain use that config object by calling Run with the test ClientConfig.
The goal of this PR is to allow full customization of the
client.Config
(including itsSocket
,BaseURL
andUserAgent
members) for callers ofcli.Run()
. This is achieved by adding aRunOptions
struct as argument tocli.Run()
.The
clientConfig
global variable isn't accessed by any non-test code, so it can be removed.Additional information about test-related changes:
The global variable WAS used in tests (as
ClientConfig
, ininternals/cli/cli_test.go
:cli.ClientConfig.BaseURL = server.URL
), but since all tests usecli.RunMain()
(which is defined incli/export_test.go
) instead ofcli.Run()
, we can just define the global variable for the tests only, and makeRunMain
use that config object by callingRun
with the testClientConfig
.