Tags » Golang

Golang: HTTP Client & Server with Query Params


func TestDelete(id string, registered bool) {
      path := "http://localhost:8085/v1/shops"

      // Create client
      client := &http.Client{}

      // Create request
      req, err := http.NewRequest("DELETE", path, nil)
      if err != nil {

      q := req.URL.Query()
      q.Add("id", r.UID)
      q.Add("registered", strconv.FormatBool(registered))
      req.URL.RawQuery = q.Encode()


      // Fetch Request
      resp, err := client.Do(req)
      if err != nil {
      defer resp.Body.Close()

      // Read Response Body
      respBody, err := ioutil.ReadAll(resp.Body)
      if err != nil {
      fmt.Printf("response=%v body=%v", resp, respBody)
      // the server returns a slice in response body
      var out []string
      json.Unmarshal(respBody, &out)
      fmt.Printf("response=%s", out)
… 135 more words

Building a bitcoin controller for Kubernetes part V - establishing connectivity

Our bitcoin controller now has the basic functionality that we expect – it can synchronize the to-be state and the as-is state and update status information. 1,639 more words


Building a bitcoin controller for Kubernetes part IV - garbage collection and status updates

In our short series on implementing a bitcoin controller for Kubernetes, we have reached the point where the controller is actually bringing up bitcoin nodes in our network. 1,649 more words


Schedule Updates: Coding, Meetups, Twitch Streams, Etc.

Here is my updated schedule for the two weeks starting August 12th for my Twitch streams, the basic topics, meetups (a little beyond two weeks), and related events coming up. 216 more words


Building a bitcoin controller for Kubernetes part III - service accounts and the reconciliation function

In the previous post, we have reached the point where our controller is up and running and is starting to handle events. However, we hit upon a problem at the end of the last post – when running in-cluster, our controller uses a service account which is not authorized to access our bitcoin network resources. 2,008 more words


How pointers work in GoLang

Pointers in Go Lang

Just like C, go lang also supported pointers. I have explained it in details with a simple working code.
Check out the code at github: … 10 more words


How Closures work in Go Lang

Closures in go

Closure is a nested function that has access to the parent variables, even after the parent has executed.

Github code :https://github.com/premaseem/golangConcepts/blob/master/concepts/closure/closure.go… 6 more words