Day 15 of 100
progress
- figured out scope issues with pointer and struct
- Used
omitempty
in struct - exported final report in json format after searching for matching image id from ec2 instance image id
- Find it interesting how much more wordy the go search method was, but appreciate it in a way as the “syntactic” sugar that’s missing also is the reason there is more complication at times in languages like PowerShell/C#.
tech development 100DaysOfCode microblog golang Day 14 of 100
progress
- built golang function with aws-sdk that returned ec2 instances, images
- Joined the data together together to search for matching image from the ec2 metadata
- generated json report from results and final struct
tech development 100DaysOfCode microblog golang 
Day 14 of 100
progress
- Migrated my new aws lambda logger from zap to zerolog. Zap gave me some problems initially so zerolog is my favorite structured logger right now, much simpler.
- Constructed
go-task
runner file for launching go test and go build/run. - Structured logging required a little bit of refactor but worked.
Here’s an example of providing back a logged string (don’t log secrets normally, but I’m in testing phase) with structure.
log.Debug().
Str("decodedBinarySecret", decodedBinarySecret).
Str("secretString", secretString).
Msg("Depending on whether the secret is a string or binary, one of these fields will be populated.")
Based on my improved understanding of conversions vs type assertions, the need to convert using a “cast” (Go calls these conversions, and yes it makes a copy in memory for this):
log.Info().Str("requestDump", string(requestDump)).Msg("request information")
Type assertions are done when working with an interface.
I’m still working on my understanding of interfaces as they are their own beast in Go.
Unlike most other languages, a Go type implements an interface when all the required methods are matched.
This provides a great deal of the flexibility in Go interfaces.
The scoping of the interfaces is important, and while I listened to a lecture on this, I didn’t yet work through the interface design principles to ensure the best resusability/narrowness of scope concepts.
I think that’s going to take more “getting my hands dirty” for it to click.
links
tech development 100DaysOfCode microblog golang I couldn’t get past this for a while when I accidentally stumbled across a fix.
I believe the fix was merged, however this problem still existed in 0.13.4
so I stuck with it.
When investigating the cause, I found this PR which intended this to be the installer behaviour for the implicit global cache, in order to match 0.12. Any providers found in the global cache directory are only installed from the cache, and the registry is not queried.
Note that this behaviour can be overridden using provider_installation configuration. That is, you can specify configuration like this ~/.terraform.d/providercache.tfrc
GitHub Issue Comment
I used the code snippet here: micro ~/.terraform.d/providercache.tfrc
Wasn’t sure if it was interpreted with shell, so I didn’t use the relative path ~/.terraform.d/plugins
, though that might work as well.
provider_installation {
filesystem_mirror {
path = "/Users/sheldonhull/.terraform.d/plugins"
}
direct {
exclude = []
}
}
After this terraform init
worked.
tech development microblog terraform troubleshooting Day 13 of 100
progress
- Worked with type asserts in my efforts to generate json collection from the parsed front matter.
links
tech development 100DaysOfCode microblog golang My morning. Explaining set and intersect theory basics to my 10 year old with Minecraft gamer tags.
Trying to justify the need to know this, the best I could come up with was his future need to build a shark attack report accurately.
Kids are the best. Tech is fun. What job would have me spin up with docker-compose up -d
my MSSQL container, write a quick SQL example with INTERSECT
, UNION
and all to demonstrate this magic.
Followed it up with a half-hearted lie that my day is comprised of cmatrix
๐ which he didn’t believe for more than a couple seconds.
tech development microblog dadlife I’ve been enjoying Codespaces local development workflow with Docker containers.
I’m using macOS and on Docker experimental release.
Here are some ideas to get started on improving the development experience.
- Clone the repository in the virtual volume (supported by the extension) to eliminate the binding between host and container.
This would entail working exclusively inside the container.
- Increased Docker allowed ram to 8GB from the default of 2GB.
Any other ideas? Add a comment (powered by GitHub issues, so it’s just a GitHub issue in the backend)
tech development microblog docker codespaces visual-studio-code I took a quick step back when too many parentheses started showing up.
If you question the complexity of your quick snippet, you are probably right that there is a much simpler way to do things.
I wanted to get a trimmed message of the results of git status -s
.
As I worked on this snippet, I realized it was becoming way overcomplicated. ๐
$(((git status -s) -join ',') -split '')[0..20] -join ''
I knew my experimentation was going down the wrong road, so I took a quick step back to see what someone else did.
Sure enough, Stack Overflow provided me a snippet.
$(((git status -s) -join ','))[0..20] -join '' # returns the string '12345'
Moral of the story… there’s always someone smarter on Stack Overflow. ๐
tech development microblog 
Day 12 of 100
progress
- Worked on Algolia index project to do atomic updates on search index on my blog.
- Worked with json, structs, ranges, and more.
- Saw success with the first value in my output now correctly parsing out the title from the front matter.
- Implemented zerolog.
- Used front library to parse yaml front matter into map.
- Accessed map to get title into json.
Hoping that eventually I can build out a Go app for sharing that’s the equivalent of “atomic alogia” allowing diff updates.
I haven’t found anything like that for hugo so far.
links
tech development 100DaysOfCode microblog golang Day 11 of 100
progress
- Pluralsight Go material and some reading.
- Start Learning Go Web Development course by Jon Calhoun.
- Created repo and logged initial progress
Link
tech development 100DaysOfCode microblog golang Beat Deadcells with 3 cells active.
Uninstalled.
There is no way I’d find any pleasure in life trying to do more.
This game is an endless pit of “git gud”.
Now to go do something productive ๐
gaming ramblings A quick fix to improve your debugging of remote commands in AWS is to install cw.
With a quick install, you can run a command like: cw tail -f --profile=qa --region=eu-west-1 ssm/custom-automation-docs/my-custom-doc
.
This will give you a real-time stream of what’s running.
You can also use the AWS Visual Studio Code extension, but I prefer having a terminal open streaming this as I don’t have to go in and refresh any further tools to see what’s happening.
I tend to always start with a single instance/resource for debugging so this is a great way to remove the barrier to visibility a bit more.
tech development microblog cool-tools aws golang Checkout delta for a much-improved git diff experience.
I typically use VSCode or a GUI based editor because I find the diff view pretty messy by default.
This new diff view is a perfect example of a simple CLI tool that improves a development workflow by just fixing something I didn’t know could easily be fixed. ๐

tech development microblog git cool-tools 
Day 10 of 100
progress
- Experimented with CLI tool using go-prompt
- Customized initial options
- OS independent call to get user home directory.
- Iterated through a directory listing
- Used path join to initialize path for directory search.
- One challenge in working with structs being returned was figuring out how to print the values of the struct.
Initially, I only had pointers to the values coming back.
This made sense, though, as I watched a tutorial this weekend on slices, and better understand that a slice is actually a small data structure being described by: pointer to the location in memory, length, and the capacity of the slice.
Without this tutorial, I think seeing the pointer addresses coming through would have been pretty confusing.
- In reading StackOverflow, I realized it’s a “slice of interfaces”.
- Worked with apex logger and moved some of the log output to debug level logging.
- Final result
links
source
tech development 100DaysOfCode microblog golang Day 9 of 100
progress
- Watched some Pluralsight and other material on testing with Go
tech development 100DaysOfCode microblog golang 
Day 8 of 100
progress
- Worked through Algorithms in Go:
Determine if a number is in a list
- Passed the tests without needing to find the solution, so that’s a win.
- Had to remember to grab the second value from the range operator like
for _, i := range items
instead of using foreach($i in $items)
like PowerShell would do. It’s more similar to using hashtables with GetEnumerator()
. - Used codespaces with Docker and also experimented with WSL2 and Visual Studio Code mounting the directory from inside WSL2.
links
tech development 100DaysOfCode microblog golang Migrated a forked copy of a module over to a new module with similar schema.
There were some additional properties that were removed.
In rerunning the plan I was expecting to see some issues with resources being broken down and rebuilt.
Instead, Terraform elegantly handled the module change.
I imagine this has to do with the resource name mapping being the same, but regardless it’s another great example of how agile Terraform can be.
tech development microblog terraform 
Day 7 of 100
progress
- Successfully deployed lambda to AWS
- Figured out how to return value cleanly from AWS Lambda vs the log output.
tech development 100DaysOfCode microblog golang Day 6 of 100
progress
- Learned a little on bubble sort algorithm
- Edited aws-go lambda tests
- Used debugger a bit more to look at error return values on failure
tech development 100DaysOfCode microblog golang I use Dash for improved doc access.
Terraform updated recently to 0.13.x
and I began having odd issues with AWS provider results coming through.
If you need to rollback, just go to the preferences and pick an older docset, in my case 0.13.0
worked correctly.
Make sure to remove the problematic version (the uninstall refers to just the most recent, not any additional versions you selected under the dropdown)
If the index doesn’t rebuild, you can close the app, manually remove the index, and it will rebuild on open.
I’m pretty sure you don’t need to do this if you use the uninstall option in the dialogue.
On macOS 10.15, you can find the index at ~/Library/Application Support/Dash/Data/manIndex.dsidx
and delete this.
Reopen Dash and it will rebuild the index.
tech development microblog aws terraform cool-tools