All posts

2023

How Many Commits Did You Make in Last Month

Been playing with opencommit and wanted to assess how much using it on every single commit I still could track locally might cost me.

This script loops through all the ${HOME}/git directories and totals the commits made in last month.

Looks like using OpenAI’s api would cost me about $4-$5 if I’d used on every single commit and the size of the commits was smaller.

Not as bad as I’d thought it would be.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 …
  read more

O'Reilly

Creating a new chrome alias so my typo doesn’t keep annoying me. I’m lucky enough to have access to O’Reilly Books through $work.

Problem is everytime I google it I keep letting my autocomplete show me O’Reilly Auto. πŸ˜„

Digital Garden Released

Split my blog into notes.sheldonhull.com for evergreen note taking and reference content. I’ll still maintain this blog for posts.

Mkdocs allows a minimal friction to publishing and previewing. The directory structure is built automatically from directories.

While I love Hugo, it’s more work to maintain small reference pages so I’m going to split up my notes more like a “digital garden” approach.

  • Free hosting through GitHub.
  • 60 seconds from push to page refresh. …
  read more

2022

Amply Repaid

That’s how children reward you for having them. They are such a responsibility and such a miracle at the same time, that the miracle of the relationship you can have with them amply repays you for the responsibility, if you can only see it. But then you have to go into the depths and take that relationship as a sacred reality and ethical requirement. And you deal with those things casually at your great peril. - Jordan Peterson1

This was a beautiful quote that I had to capture from …

  read more

To Get a Cup of Coffee

  • Take the car into shop to get state inspection that’s overdue, since I don’t drive it much.
  • Find out a check engine light fails the test.
  • Drive towards grocery store near house, and hit a long line of traffic.
  • Decide to be a dilligent budgeter and pick up milk instead of buying coffee.
  • Train decides to park at road I have to cross.
  • Go to gas station, grab milk.
  • Arrive home.
  • Make coffee.

Sometimes working from an office has it’s advantages, especially those fancy places with …

  read more

Check Azure Devops Pr for Conventional Commit Title

Conventional Commit

  • Is it needed… No.
  • Is it the only way… No.
  • Is consistency better than inconsistentcy, mostly yes.

I’ve used conventional commit most of my career and it’s a fine basic standard, even if sometimes it feels strange as you get used to it. I think it’s far better than inconsistency and is common enough with tooling you can do some nice release, changelog, and versioning with it.

However, getting folks used to it can be tricky. I’m a big …

  read more

The Pulumi Verdict So Far

What Pulumi Is

  • Pulumi is like a muscle car. Great if you want full control, power, and flexibility.
  • Pulumi is fast.
  • Has actual loops. Sorry HCL… Your loops are just confusing.1

What Pulumi Is Not

  • Pulumi is like a rally car. You will be traveling a gravel road that might result in a few bumps and potholes. It can handle it. However, there are things (just like HCL had/has over time) you’ll run into that don’t make sense or are bugs, but since it’s younger there might …
  read more

Using Randomization for Pulumi Kubernetes Resources

Logical Names

Pulumi requires unique logical names (URN) for tracking the state of resources. I ran into an issue with this once I expanded to a multi-cluster deployment since Pulumi began erroring on the logical name not being unique. Let’s say you are defining a service:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
_, err = corev1.NewService(
		ctx,
		"myservice", // πŸ‘ˆπŸ‘ˆπŸ‘ˆπŸ‘ˆ this is the logical name
        &corev1.ServiceArgs{
            ApiVersion: pulumi.String("v1"), …
  read more

Remove Pending Operations From Pulumi State

If you need to work through some issues with a deployment and remove a pending operation in Pulumi state file, you can do this pretty easily manually, or save a quick bit of scrolling and use gojq (or jq if you want).

  • Export: pulumi stack export --file state.json
  • Align formatting: cat state.json | gojq > stateFormatted.json
  • Remove pending operation: cat stateFormatted.json | gojq '.deployment.pending_operations = []' > stateNew.json
  • Now you can compare the results without any whitespace …
  read more

Pulumi Secrets

Chicken or The Egg

Secrets with infrastructure are a problem.

  • I want to source control my secrets, and deploy via CD.
  • I want to use infrastructure-as-code to define my configuration, including secrets.

But I don’t want to expose the values at any stage during this. I want to keep them in a secret store, and only expose them when I need them, but I still want to manage them via code.

For a while I’ve done a blend of loading local environment variables or creating manually in a …

  read more

Go Templates With Kubectl

An alternative to using jsonpath with kubectl is go templates!

Try switching this:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
kubectl get serviceaccount myserviceaccount --context supercoolcontext --namespace themagicalcloud -o jsonpath='{.secrets[0].name}'
```

To this and it should work just the same.
Since I know go templates pretty well, this is a good alternative for jsonpath syntax.

````shell
kubectl get serviceaccount myserviceaccount --context supercoolcontext --namespace …
  read more

My Job

Acted like I wasn’t going to go to work today with my 4 year old daughter. She looked over at me and told me I don’t have to go somewhere, I just walk up the stairs. “Your boss will want you to go to work today”. Very astitute, I observed.

But what do I do when I go to work? Do I fix cars, construction, or other things?

She looked at at me and said I put on my headset and talk to people about important stuff.

No cool computer hacker cred for me today.

  read more

Pulumi Round 2

This is not a comprehensive article, but more a log of the issues and wins as I work through Pulumi adoption.

tl;dr

  • Pulumi is pretty powerful.
  • Once you get beyond the basics, it requires a lot of effort since the tooling doesn’t have as many examples as I’d hope. This is especially true for Kubernetes. It’s a lot easier to get moving on other providers.
  • It’s more intensive of a pilot to do complex things IMO than Terraform, because you aren’t getting pre-built …
  read more

2021

Contents

Helm Is Like Hugo

Turns out helm is pretty intuitive if you already have been working with something like Hugo, which is Go template driven.

Was able to convert an entire K8 stack to helm with a couple hours of work and render everything.

I have this problem of trying to avoid percieved complex tools in an attempt to reduce “another tool” syndrome for others I work with. Sometimes, it’s important to keep in mind who is editing and doing the majority of the work, and not worry as much about the …

  read more

Go R1 Day 86 - Wrap Up!

Finished!

Done! I’ve pretty much done above and beyond 100 days, but finding the blogging format to take a lot more effort to keep up when I’m doing a mix of puzzles, courses, and work.

Since my full-time job has Go development as a part of it now, I’ve exceeded this and going to track any future training goals in a lower overhead way, such as GitHub issues or such.

Was It Worth It?

Yes, it was worth it. It helped me break down a large amount of learning back into a daily rythm …

  read more

Setup Sourcegraph Locally

I went through the Sourcegraph directions, but had a few challenges due to the majority of code being behind SSH access with Azure DevOps.

Finally figured out how to do this, with multiple repos in one command and no need to embed a token using https.

Navigate to: manage-repos and use this.1 Better yet, use Loading configuration via the file system (declarative config) - Sourcegraph docs and persist locally in case you want to upgrade or rebuild the container.

{
  "url": …
  read more

Docker Healthchecks for Spinning Up Local Stacks

I’ve used a few approaches in the past with “wait-for-it” style containers.

Realized there’s some great features with healthchecks in Docker compose so I decided to try it out and it worked perfectly for Docker compose setup.

This can be a great way to add some container health checks in Docker Compose files, or directly in the Dockerfile itself.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42 …
  read more

Go R1 Day 85

progress

πŸŽ‰Finished Ultimate Syntax course.

Worked on Enumerators concept using iota.

I still find this very confusing in general.

Here’s the gist I created.

Go R1 Day 84

progress

Ultimate Syntax (Ardan Labs - Bill Kennedy) and went back through various topics such as:

  • Pointers: One thing mentioned that resonated with me was the confusion regarding pointers in parameter declarations. I also find the usage strange that the deference operator is used to denote a pointer value being dereferences in the parameter. I’d expect a pointer value to pass clearly with func (mypointer &int) and not func (mypointer int) with a pointer call.
  • Literal Structs: Great …
  read more

Thermal Throttling Mac Intel Woes

I lost roughly half a day in productivity. CPU hit 100% for an extended period, making it difficult to even use the terminal.

Initially, I thought the culprit was Docker, as it was running some activity with local codespaces and linting tools. Killing Docker did nothing.

Htop pointed out kernel as the primary hog, and you can’t kill that.

After digging around online, I found further mentions about charging on the right side, not the left to avoid thermal issues causing CPU throttling.

The …

  read more

Go R1 Day 83

progress

Revisited Ultimate Syntax (Ardan Labs - Bill Kennedy) and went back through various topics such as:

  • Variables: When to use var vs walrus operator for readability and zero value initialization.
  • Type Conversions: How identical named types aren’t the same in Go’s eyes when named.
  • Pointers: General overview. Mostly stuff I knew, but good basic overview again.

Keyboard Remapping in Goland

This is a continuation of my evaluation using Goland.

I tend to be a VSCode user primarily, but am working on adopting Goland incrementally to leverage some of it’s features that work a bit more consistently (like refactoring).

Losing keyboard shortcuts is painful.

VSCode lets you assign keyboard shortcuts in command pallette by clicking on the gear icon in the command you hover over. For a while I couldn’t find this in Goland. I see now I can assign any action defined from the quick …

  read more

Go R1 Day 80

progress

Built a Mage task to handle creation of Azure DevOps pull requests. Since the tooling out there is primarily around Github, this was useful to help standardize PR creation with autocomplete, conventional commit naming, and other properties that typically require manual changes. I found a great little TUI components library that simplified using Bubbletea components: Promptkit .

In addition, noticed some new linting help from golangci-lint for varnamelen.

This was useful as it analyzes …

  read more

Go R1 Day 79

progress

Felt like revisiting Exercism since the great updates and wanting a break from the more deep concept dives on mechnical sympathy and optimization in the Ultimate Go course (which is stellar).

Completed the following to continue on syllabus. It’s taking me back to basics, but stuff I can knock out pretty quick.

  read more

Go R1 Day 78

progress

Ultimate Go: 2.3.4 - Pointers-Part 4 (Stack Growth)

Scenario:

  • 2k stack for each goroutine.
  • 50,000 goroutines.
  • Eventually, you’ll want to make the function call and you’ll want to grow the stack if the current stack limit is hit.
  • We’ll want to use contigous stacks.
  • The new stack will be a new contigous allocated block of memory.
  • The stack growth requires all the prior values to be moved over to the new doubled stack.

A goroutine can only share values from the heap. …

  read more

Go R1 Day 77

progress

More Fun With Golangci-lint

Been doing a ton the last month with golangci-lint tooling. I think this has been one of the most educational tools for learning Go I’ve come across. It has forced me to evaluate why issues are flagged, if they are opinionated preferences or best practices.

For example, wsl ensures that statements are not cuddled. This follows Dave Cheney’s writing about having an empty line seperate phrases of thought.

It’s a bit annoying to implement as a …

  read more

Go R1 Day 76

progress

Lots of more technical detail on Memory & Data Semantics Section.

I value this as my background in databases means that things like Stack/Heap weren’t part of my education as much. This has been useful as there are new concepts, paradigms, and ways of thinking and it’s providing a lot more foundational concepts for me to better understanding the system and compiler behavior in Go.

Ultimate Go: Pointers-Part-3: Escape Analysis

Notes

  • Stacks are self-cleaning
  • Compiler …
  read more

Go R1 Day 74

progress

  • Worked with DynamoDB schema (NoSQL Document database).
  • Invoked local lambda function using Docker and also remove invocation with serverless invoke. This took a bit of work to figure out as the parameters weren’t quite clear. Upon using --path for the json template I got from AWS Lambda console, I was able to to get to invoke, and stream the logs with --log.
  • More mage magic with promptui and other features, so I can now test a full tear down, build, publish, and invoke a test …
  read more

Go R1 Day 73

progress

  • I’m more on day 90+ but haven’t made the time to log it.

  • Been working a ton with Mage and have some really cool work I’ll be writing up soon, including using for health checks on projects, setup of core tooling, encoding credentials, and more. πŸ’―

  • Also been working heavily on Go mono-repo module structure and some serverless based architecture tests that will make a fun write-up. I’m thinking of a demo of “Disappointment as a Service” with a …

  read more

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. …
  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
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 * time. …
  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

SweetOps Slack Archive

Just wanted to give props to the Cloudposse team lead by Erik Osterman @eosterman .

Slack provides a great community chat experience, but there are quite a few problems about using it for Q&A. 1 Since the free plans for communities hide content over 10,000 messages, a healthy community will go over this quickly.

With all the great conversations, I want to find prior discussions to benefit from topics already covered.

Cloudposse archives the community discussions so they can be searched. …

  read more

Go R1 Day 62

progress

  • Worked with mocks.

Still using the is package to test.

1
2
3
if !reflect.DeepEqual(want, spySleepPrinter.Calls) {
  t.Errorf("wanted calls %v got %v", want, spySleepPrinter.Calls)
}

was replaced with:

1
is.Equal(spySleepPrinter.Calls, want) // spySleepPrinter shows correct order of calls

Go is messing with my head with how everything gets simplified to the lowest common interface when possible. Instead of buffer, I’d want to use io.Writer for example. This …

  read more

Go R1 Day 61

progress

It was a dark and stormy night. The world was bleak. A command was sent to The Compiler.

The assumptions were flawed. The command was rejected.

You have given me an invalid command with -argument-that-shall-not-work 5 being invalid.

But I’ve provided --argument-that-shall-not-work, the indomitable wizard said.

Your command is unworthy.

Digging into esoteric tomes of knowledge, the wizard discovered others have had similar issues when calling external processes using the …

  read more

Go R1 Day 60

progress

  • Finished up the basics of dependency injection and how this helps with testable code.
  • Worked through concurrency test using channels and go routines. This will take a bit more to get comfortable with as there is a variety of concepts here. My initial attempts finally started working using an anonymous function, but couldn’t finalize due to some issue with launching the parallel executable being called. Not sure why the --argname seemed to be trimming the first dash from the …
  read more

Go R1 Day 59

progress

  • Built some Mage tasks for setup of local projects.
  • Used retool post from Nate Finch with Mage project and found it promising to vendor Go based tooling into a local project and not rely on the global package library.
  • Created magetools repo to house some basic general mage tasks I could share with other projects.
1
2
year, month, day := time.Now().Date()
dateString := fmt.Sprintf("%d-%02d-%d", year, month, day)

Use padding in the Sprintf call to ensure a date comes back …

  read more

Go R1 Day 57

progress

  • Did some adhoc work in this repo (the hugo repo that contains this blog) testing out Mage, which is a Go based Make alternative.
  • Generated dynamic target directory for hugo posts using stringify for kebab case.
  • Unexpected behavior when generating dynamic file path including date.
1
2
3
year, month, day := time.Now().Date()
str := stringy.New(title)
slugTitle := strings.Join([]string{string(year), string(month), string(day), str.KebabCase("?", "").ToLower()}, …
  read more

Go R1 Day 56

progress

  • Worked on ci-cd pipelines for Go apps.
  • Learned a bit more on building Azure Pipeline templates to use with Go, learning a bit from SignalFx and how they did it.
  • Read more on semver versioning, and still can’t find anything as good as GitVersion
  read more

Go R1 Day 58

progress

  • Avoiding a panic in Go for missing dictionary match is very straight forward. The error pattern for failed conversions and out of range index matches is the same, with: ok, err := action.
  • TODO: Figure out if ok to reference an error in a test by: is.Equal(error.Error(),"unable to find value in map"). Linter warns me with: Method call 'err.Error()' might lead to a nil pointer dereference.
  • Started work with dependency injection.
  read more

My Goland Log

Purpose

This is a log of my second journey in using Goland from Jetbrains for Go development.

I’ve got VSCode in a great state. It’s flexible, powerful, and I’ve highly customized it to my workflow.

However, doing Go development, I’d like to better explore Jetbrains Goland and see if the experience proves positive.

I’ll log updates and issues here as I work through it in the hope that it might provide you better information if you are considering Goland as well. …

  read more

Go R1 Day 55

progress

In Go, when you call a function or a method the arguments are copied. 1

  • Built some test cases for working with pointers and test methods.
  • Did this in Goland to become more familar with it and figured out how to use the nice tests explorer with a floating window to auto-test.
  • Built a filewatcher configuration watcher as alternative to tests panel, allowing automated run in terminal or output panel of go test ./....
  • Couldn’t figure out how to run every test in project, as …
  read more

Go R1 Day 54

progress

  • worked with tests and Goland.
  • Modified table driven tests to remove hard coded test case inputs.

Steampipe Is Sql Magic

Up And Running In Minutes

I tried Steampipe out for the first time today.

 Follow Steampipe On Twitter

I’m seriously impressed.

I built a project go-aws-ami-metrics last year to test out some Go that would iterate through instances and AMIs to build out aging information on the instances.

I used it to help me work through how to use the AWS SDK to iterate through regions, instances, images, and more.

In 15 mins I just solved the equivalent issue in a way that would benefit anyone …

  read more

Go R1 Day 53

progress

  • Troubleshooting on: typechecking loop that helped me learn a bit more on how the compiler parsing occurs. Quick fix was to simply change var logger *logger.Logger to var log *logger.Logger.
  • Read up on dependency injection concepts and clean architecture design.
  read more

Go R1 Day 52

progress

  • published extension pack for Go1
  • Learned about magic number linter in golanglint-ci. For instance this would be flagged as a bad practice (while not applicable for a simple test like this, having a const makes sense in almost all other cases).
1
2
3
func Perimeter(width float64, height float64) float64 {
	return 2 * (width + height)
}
  • Learned a few extra linter violations and how to exclude including:
    • lll: for maximum line length
    • packagetest: for emphasizing blackbox testing. …
  read more

My First Vscode Extension Pack for Go

Took a swing at creating my own extension pack for Go.

  sheldonhull/extension-pack-go - GitHub

This was a good chance to familarize myself with the eco-system and simplify sharing a preset group of extensions.

Setup the repo with a Taskfile.yml to simplify running in the future. If frequent updates needed to happen, it would be easy to plug this into GitHub actions with a dispatch event and run on demand or per merge to main.

Here’s the marketplace link if you want to see what it …

  read more

Go R1 Day 51

progress

  • Did iteration exercise, however, I skipped ahead and did strings.Repeat instead of iteration because I’m lazy. πŸ˜€
  • Moved all tests into blackbox test packages.
  • Worked through variadiac functions.
  • Tweaked my VSCode autotest to run on save.
  • Further tweaks to golanglint-ci to reduce noise on linting checks.

  read more

Use Driftctl to Detect Infra Drift

Use Driftctl to detect drift in your your infrastructure. This snippet generates a html report to show coverage and drift figures of the target.

For multiple states, you’ll need to adapt this to provide more --from paths to ensure all state files are used to identify coverage.

1
2
3
4
5
6
7
8
9
$S3BucketUri = "terraform-states-$AWS_ACCOUNT_NUMBER/$AWS_REGION/$TERRAFORMMODULE/terraform.tfstate"
$Date = $(Get-Date -Format 'yyyy-MM-dd-HHmmss')
$ArtifactDirectory = ( …
  read more

Go R1 Day 50

progress

At this point, I’m still struggling with the proper way to abstract a logging wrapper that calls a logging library. There’s enough boilerplate for setup of my preferred defaults in zerolog that I want to include …

  read more

Go R1 Day 49

progress

  • Learned about White-Box vs Black-Box testing. Apparently, you can access all indentifiers of a package if you use the same package name such as: package packagename. If you are testing as a consumer might be, then you can use package packagename_test for only accessing the exported identifiers.
  • Used examples in test file to provide self-documentation of how to use the method.
  • Worked further with golanglint-ci and found it challenging when working with multiple modules in …
  read more

How To Reduce Noise From Slack

Noise

Slack can be a really effective tool with asynchronous work, but the defaults aren’t great out of the box.

I want to get you a few tips on how to use Slack effectively.

Piping through release notifications, work-item updates, alerts and more can help you reduce context switching with other tools, but without proper control you’ll likely find it overwhelming.

Sections

Use sections to organize your content and customize the level of priority you want to assign to the grouped …

  read more

Go R1 Day 48

progress

  • worked through more test concepts with learn-go-with-tests, including test helpers.
  • enjoyed the results GitHub copilot was producing. I can see a lot of promise for speeding up things and reducing the need for snippets as it builds code suggestions on the fly with far more context than a general snippet could do.

  read more

Luminar AI

Update

Customer service bumped my older version of Luminar 3 to 4. The issues with distortion on the preview screen aren’t there with version 4.

The new AI enhancements aren’t there, so it’s missing some of the new features. For now I’m going to try and use this as my daily driver for images and see how it goes. …

  read more

Simplify Aws Developer Security With Leapp

Security Is Necessary Work

Security can add overhead, get in the way, complicate development, generally can cause challenges to development efforts. The balance of security and usability is one that all development organizations have to deal with.

I could be ultra-secure by requiring carrier pigeon multi-factor authentication for my team, but I’m not sure that would be well received.

  read more

Go R1 Day 47

progress

  • worked with lefthook to run golang-lint tools and discovered how vast the configuration for this was, simplifying many of the other linting tools that was running seperately.
  • created some goyek tasks for bringing up and down docker compose stacks.
  • learned that file.Close() shouldn’t be used with defer to avoid unsafe file handling operations.
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
// taskComposeDestroy tears down the docker stack including volumes
// this is …
  read more

Go R1 Day 46

progress

  • At $work I focused on dockertest.
  • Modified the provided test statements to ensure autoremoval of container occurred on failure.
  • Had packet issues I couldn’t figure out this time, so shelved for now. packets.go:37: unexpected eof
  • At home, I played with bubbleteam a bit, and decided while an epic TUI interface, the framework is far too involved for what I want to mess around with at this time. For instance, it doesn’t provide multi-select, instead much of that is manually …
  read more

Understanding The Basics of SQL Server Security

Confusing

As I’ve worked with folks using other database engines, I’ve realized that Microsoft SQL Server has some terminology and handling that is a bit confusing. Here’s my attempt to clarify the basics for myself and others needing a quick overview. This is not comprehensive coverage of security architecture, which is a very complex topic, more just terminology.

Terminology

Note that it’s best to consider SQL Server as it’s own operating system, not just a …

  read more

Go R1 Day 45

progress

  • Worked through merging flags and the “run” approach from Mat Ryer.
  • Used ff for parsing.

The resulting logic seems correct with main being very simple with:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
package main
import(
    "io"
    "flag"
    "os"
    "github.com/peterbourgon/ff/v3"
    "github.com/peterbourgon/ff/v3/ffcli"
    "github.com/peterbourgon/ff/v3/fftoml"
)
const (
 // exitFail is the …
  read more

Go R1 Day 44

progress

  • Generated tests for Gorilla Mux and realized need more context and reading on how to properly test Gorilla Mux to avoid excessively mocking.
  • Reviewed two different paradigms for struct methods, using parameters and using global configuration objects.
  read more

Go R1 Day 43

progress

  • Modified forked SharedBrain repo to use yaml parser instead of toml.
  • Modified tests handle invalid casting of interface, which was causing a panic.
1
2
3
4
otherDate, ok := otherDateInt.(time.Time)
if !ok {
  log.Printf("[time.Parse] probable invalid date format %s", plainFilename)
}
  • Improved tests to align to markdown standard formatting.
  • FOSS license scanned on 4 repos to test compliance of licensing for badge.
  • Use goyek templates to build out initial go based build …
  read more

Go R1 Day 41

progress

  • Enabled Go code coverage for tests in VSCode
  • go install github.com/jpoles1/[email protected] to install tooling for generating code coverage badge for readme.
  • Set ![gopherbadger-tag-do-not-edit]() in the readme, and then this gets replaced with a code coverage percentage badge.
  • Generate the required code coverage reports using: go test -coverprofile cover.out followed by go tool cover -html=cover.out -o coverage.html for a visual report.
  read more

Go R1 Day 40

progress

  • Learned a bit more modules vs packages, including internal package special behavior.
  • Configured Azure DevOps remote module source with package level imports.
  • Successfully migrated a utility logger for setup of Zerolog into a seperate remote module for importing.
  • Setup 50% test coverage for logger using gotest test generator.
  • Used Is for test setup. (this would be a cool use of gotest templates test generation)
  • Modified sharedbrain forked repo to generate yaml front matter with dashes. …
  read more

Go R1 Day 39

progress

  • built a better understanding of how to resolve Go modules from private Azure DevOps instances

Using Azure DevOps for Private Go Modules

2022-12-14
Provided an example of how to handle private go modules in Azure Pipeline compatible method.

TL;DR

This took a few hours of work to iron out, so figured maybe I’d save someone time.

⚑ Just keep it simple and use SSH

⚑ Use dev.azure.com even if using older project.visualstudio.com to keep things simple.

Modules …

  read more

GitPod User Feedback

  1. Thank you GitPod for integrating with VSCode. πŸŽ‰
  2. Upcoming ssh support, so freaking cool! Are you using Chisel in the backend per the GitHub issues I found discussing workaround? As a Go dev, I’m interested ⚑ I believe Jetbrains + VSCode users will now both be able to leverage the same backend.
  3. GitHub took over the codespace arena with Visual Studio Codespaces being abandoned. Enterprise customers using Azure Repos can’t benefit from any of this new flexibility πŸ’”. Is it in the roadmap …
  read more

Log4 Brains Improves ADR Experience

I’m a fan of architectural decision records. Docs as code sets a practice for a team to track decisions in process and design.

Log4Brains provides markdown template based adr creation, with an option to render a static site for reading.

If you want to start managing your ADRs in a structured way, but benefit from simple markdown as the source files, then this is a great option to consider.

It’s really easy to get started with docker, no npm install required.

Just run: docker run …

  read more

Career Advice From a Drunk Dev on Reddit

Drunk Post: Things I’ve learned as a Sr Engineer has trending with some fantastic discussion on Twitter & Reddit.

What makes it so interesting is the raw and unfiltered message, mixed in with some great humor.

My Background

The author of that post comes from a Data Engineer side.

I’ve been a Database Developer, Production …

  read more

Highlight Problem Characters in Code

Use Vscode Gremlins to help flag characters that shouldn’t be in your code.

Specifying a Range of Invalid Characters

You can give a range to flag multiple characters with a single rule.

For example, if using macOS and the option key is set to a modifier, it’s easy to accidentally include a Latin-1 Supplemental Character that can be difficult to notice in your code.

To catch the entire range, the Latin-1-Supplement link provided shows a unicode range of: 0080β€”00FF

Configure a rule …

  read more

The Dark Side

Saw this on a Twitter thread and had to save it. If you’ve ever debated light vs dark themes, you might find this as funny as I did.

Nearly choked on my dinner.

Go R1 Day 38

progress

  • Worked on cross platform binary builds and CICD with GoReleaser.
  • Lots of container work here.
  • Started blog post on how to use GoReleaser.

Value Local Art

Our culture is driven on some much virtual comsumption of media and performances. It’s important to remember just how critical it is to support local art and performance.

In a YouTube culture, it’s easy to default to virtualized arts. I think it’s easy to lose the appreciation for the disciplined effort creating music, dance, art requires when it’s all just something on a screen.

It also gives an unrealistic expectation for live performances if our only consumption is the …

  read more

Dance Time

Uploaded a few to my gallery from time I had with my daughter watching her live performance this weekend. Take a peek.

I need to catch-up on a few posts with the family with all the great stuff they’ve been doing lately. (My son just got his black belt in Taekwondo πŸ‘)

Dance Time

The Open Guide to Amazon Web Services

The guide you didn’t know you needed for AWS. Came across this when Corey Quinn 1 mentioned this on a podcast.

This is a resource I wish I’d known about earlier. It covers the core essentials on services, and cuts through the confusion of the AWS Docs pretty well.

For example, I noticed the ELB references for ALB docs and this caused me some confusion.

Right front and center on Load Balancer Basics 2:

Before the introduction of ALBs, “Classic Load Balancers” were known …

  read more

Cloudflare Analytics for Your Jamstack Site

A new alternative to Google Analytics if you want to keep things simple.

Cloudflare Web Analytics seems promising.

I’d probably have started with this if I was setting up my site from scratch.

The problem I have with adopting a tool like this is no basic import of metrics from Google Analytics means I’d lose years of history.

Does the history matter signficantly? Not really for me. I just don’t like losing out the entire history to see how things have improved over time.

  read more

Make Vscode Annoy Me When I Make a Typo

Not sure why, but I’ve had 2 typos that keep plauging me.

  • ngnix should be nginx
  • chocolatey should be chocolatey

With Go, I get compile errors with typos, so no problem. With PowerShell or Bash, this can be really annoying and waste time in debugging.

You can configure many autocorrect tools on a system level, but I wanted a quick solution for making it super obvious in my code as I typed without any new spelling extensions.

Install Highlight: fabiospampinato.vscode-highlight 1

Configure …

  read more

Cool Way to Compare Features in Note Apps

Nice little site I came across for comparing various popular knowledge & note taking tools with ability to select features most important to you.

NoteApps

Note typically a fan of compare based tools, as they often feel like marketing junk, but this was a a pretty cool little implementation.

Azure Devops PR Automation Requires Generic Contribute

Big fan of renovate for terraform dependency management.

Ran into some complications with restarting an onboarding with Whitesource Renovate in Azure DevOps Repos and the Azure Pipeline automation. I’ve run into this before, so logging this for my sanity.

  • If you failed to onboard with Azure DevOps, you can’t rename the PR like in GitHub to simplify restarting the onboarding process.
  • Instead, delete the renovate.json file and commit to your default branch.
  • Then re-add and get the …
  read more

Hackattic

Came across this pretty nifty site HackAttic that provides a small set of practical oriented exercises. Will look at using further in my Go journey, as seems really useful to stretch one’s development skills in less familar, but still practical ways.

A few of the challenges:

  • Generate an SSL certificate according to given data.
  • Extract some data from Redis. In a way.
  • Handle some incoming JWTs for us.

Take a look at the newsletter topics covered. I love that sense of humor.

  read more

Diagrams as Code

Why

It’s not for everyone.

I prefer to write diagrams out logically and then let the visual aspect be generated.

This helps me by making the visual presentation an artifact of what is basically a written outline.

Presentation Matters

I’ve learned that communicating flows of information can often be better presented visually than trying to write them out, especially once it involves more than a few “nodes” of responsibility. Visualizing a complicated process can be done …

  read more

Go R1 Day 37

progress

  • initialized new start of cli tool to try to parse markdown content using Goldmark1 and then convert markdown links into reference style links
  • Improved default template for starting new basic cli tools with Go to include zerolog and run based design instead of the majority of logic being in main.
  read more

Go R1 Day 36

progress

  • more taskflow work
  • learned how to use io.Multiwriter to have both a stdout stream as well as output captured to a stringbuilder.
  • got confused on reading docs, only to realize I was reading docs for a C# solution. πŸ˜‚
  • used Pterm1 to beautiful console output, which was pretty cool to see in action.
  read more

Go R1 Day 35

progress

  • Worked with Taskflow a bit more.
  • Need to identify better error handling pattern on when to resolve vs handle internal to a function, as it feels like I’m doing needless error checking.
  • Wrote func to run terraform init, plan, and apply.
  • This takes dynamical inputs for vars and backend file.
  • Also dynamically switches terraform versions by running tfswitch.

Definitely more verbose code than powershell, but it’s a good way to get used to Go while achieving some useful …

  read more

Go R1 Day 34

progress

  • figured out how to import util/logger.go as a package
  • after much confusion due to logger, log, *zerolog.Logger and more variables all deviously similar in name… how to pass around the initialized package logger that I configure.
  • learned that global scope and package scoped loggers being initialized at run is concerned an anti-pattern
  • properly wrapping to avoid the log initialization on import with type Logger struct { logger: *zerolog.Logger; } as an example avoids the same …
  read more