My question is somewhat related to this but rather than extending an existing type im trying to create my own. My goal is to have something like this, coming from java
JsonClient j = new JsonClient()
j.setUrl("x.com")
j.setMethod(GET)
j.setData("{crap: morecrap}")
String result = j.send
But in go the best i can do is
config := jsonclient.Config{}
config.Url = "http://foaas.com/version"
config.Data = []byte(`{datadatadata}`)
config.Method = "GET"
s, err := jsonclient.NewClient(&config)
checkErr(err)
response := jsonclient.Dial(s)
I do not wish to have a config object just to setup a jsonclient instance, since it only has meaning in the, dont hit me, jsonclient class so i should be able to do jsonclient.SetUrl and so on, seams more efficient and would help me understand a couple of key points im missing in go.
You can find the jsonclient here