All posts

2021

Go R1 Day 72

progress

  • Learned more on “mechanical sympathy” related to Go and memory management.
  • How the Go compiler works related to frames with memory allocation.
  • Built Mage tasks for licensing and validating problematic licenses aren’t included in a project.
  read more

Go R1 Day 71

progress

  • Learn Go With Tests -> Using select with channels to wait for multiple goroutines.
  • Of particular interest is this:

Notice how we have to use make when creating a channel; rather than say var ch chan struct{}. When you use var the variable will be initialised with the “zero” value of the type. So for string it is “”, int it is 0, etc. For channels the zero value is nil and if you try and send to it with <- it will block forever because you cannot send to …

  read more

Go R1 Day 70

progress

  • Concurrency section wrap-up with Learn Go With Tests.
  • Reviewed material learned from: Go R1 Day 61
  • Read material, but didn’t do a lot of tests on this, per mostly concept oriented. Used concurrent progressbar example from uiprogress project to test concurrent UI updates.
  • My last concurrency test case was to launch many concurrent processes for a load test. This didn’t leverage goroutinues as typically used, since it was calling to an executable on the host machine. However, …
  read more

Go R1 Day 68

progress

  • Did exercism.io for gigasecond puzzle.
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
package gigasecond

// import path for the time package from the standard library
import (
	"time"
)

// gigasecond represents a very very very small portion of a second.
const gigasecond = 1000000000

// AddGigasecond adds a very very very small portion of a second called a gigasecond to a provided time input.
func AddGigasecond(t time.Time) time.Time {
	gcDuration := gigasecond * …
  read more

Go R1 Day 67

progress

Built functionality in my blog repo to create a new 100DaysOfCode post using Mage. This provides an interactive prompt that automatically tracks the days left and increments the counter as this progresses.

  • ingest toml configuration
  • unmarshal to struct
  • update struct
  • marshal and write back to the toml configuration file
  • replace matched tokens in file

Go R1 Day 66

progress

This wasn’t specific to Go, but was the first step towards using Go in a distributed test.

Dapr

I had an interesting project today with my first development level effort using Kubernetes. Here’s my log of attempting to use Getting started with Dapr | Dapr Docs and getting two Go APIs to talk to each other with it.

First, what is Dapr?

Dapr is a portable, event-driven runtime that makes it easy for any developer to build resilient, stateless and stateful applications that …

  read more

Go R1 Day 65

progress

  • Built mage tasks for go formatting and linting.

Using this approach, you can now drop a magefile.go file into a project and set the following:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
// +build mage

package main

import (

	"github.com/magefile/mage/mg"
	"github.com/pterm/pterm"

	// mage:import
	"github.com/sheldonhull/magetools/gotools"
)

Calling this can be done directly now as part of a startup task.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
// Init runs …
  read more

First Pass With Pulumi

Why

Instead of learning a new domain specific language that wraps up cloud provider API’s, this let’s the developer use their preferred programming language, while solving several problems that using the API’s directly don’t solve.

  • Ensure the deployment captures a state file of the changes made.
  • Workflow around the previews and deployments.
  • Easily automated policy checks and tests.

This can be a really useful tool to bring infrastructure code maintainability directly …

  read more