https://d33wubrfki0l68.cloudfront.net/3762c1a26ede5efcb0fb514523e42e656ea6fe83/02144/images/sheldonhull_gopher_avatar.png

Sheldon Hull

sheldonhull@macbook: ~/ (pwsh)
  • _________________________________
  • < Welcome! Thanks for stopping by >
  •  ---------------------------------
  •  \
  •   \
  •      __
  •     /  \
  •     |  |
  •     @  @
  •     |  |
  •     || |/
  •     || ||
  •     |\_/|
  •     \___/

Here you’ll find mostly tech talk and musings, with other topics periodically. If you want to stay in touch, look at the bottom for the curated newsletter I send out.

Cheers! ๐Ÿ™๐Ÿป


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. pterm/pterm: โœจ #PTerm is a modern go module to beautify console output ↩︎

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 automation tasks I need to do.

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 behavior as: var Log *zerolog.

Go R1 Day 33

progress successfully created logging package using zerolog learned about scoping with packages linked to a private internal repository and how to leverage the module replace operator to temporarily alter path import from url to local override. middleware is a newer concept, so I need to learn more on this later so I can understand how to use to inject special log handling for http requests and other actions. Thoughts for today are that the pressure of jumping into an existing codebase is resulting in me moving faster than I probably should.

Go R1 Day 31

progress Learned a bit about idiomatic patterns wtih error handling. Learned about inline block intiailization of variables using if err := method(); err != nil {...} approach. Considered a bit more idiomatic patterns when I noticed excessibe nested if blocks. 1 2 3 4 5 6 tfdir := tf.Params().String("tfdir") if tfdir != "" { tf.Logf("tfdir set to: [%s]", tfdir) } else { tf.Errorf("๐Ÿงช failed to get tfdir parameter: [%v]", tfdir) } This would probably be more in alignment with Go standards by writing as: