Skip to content

2021🔗

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.

Go R1 Day 41

progress

  • Enabled Go code coverage for tests in VSCode
  • go install github.com/jpoles1/gopherbadger@master 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.

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 to support this enterprise arena with Azure Repos (Part of Azure DevOps suite)? With the pull request experience in Azure Repos, I'd love to leverage pre-built GitPod workspaces, even if it required the self-hosted component.
  4. Feature Request: Consider 1-3 private workspaces for the free tier, with maybe 1 active at a time like the Codespaces beta as a good route towards adopting for private projects and testing. A limited private count would help adoption for those wanting to experiment with it for small private projects. I'd guess it might help make the jump to paid easier as it would allow the adoption of workflow in private and public projects.
  5. Lastly, beautiful job on the website changelog, and thank you @mikenikles for the RSS implementation. Your website design is beautiful.

Using Azure DevOps for Private Go Modules

{{< admonition type="Note" title="2022-12-14" open=true >}}

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

{{< /admonition >}}

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 Support

Unlike GitHub, Azure DevOps has some quirks to deal with, specifically in the odd path handling.

My original goal was to set the default handling to be https support, with the SSH override in git config allowing me to use SSH.

This didn't work.

  • HTTPS requires _git in the path.
  • SSH will not work with that, and also trims out the org name in the url when git config set based on instructions from Microsoft1.

There is a long-running issue with go get imports of Azure DevOps repositories due to the fact that the HTTPS URL contains a _git segment: 2

Compare the path.

Type Path
HTTPS go get dev.azure.com/<organization>/<project>/_git/<repo>
⚡ What I used with SSH go get dev.azure.com/<project>/_git/<repo>
SSH go get dev.azure.com/<organization>/<project>/<repo>.git

Git Config

Set this in your .profile, .bashrc, or $PROFILE

export GOPRIVATE=dev.azure.com

There are two approaches you can take.

One seems focused on allowing other dev.azure.com public projects to be used. I've never had that need, so I'm ok with my dev.azure.com references being resolved only to my own organization.

Type Command GitConfig
Support All Azure DevOps (Public) git config --global url."git@ssh.dev.azure.com:v3/<organization>/".insteadOf "https://dev.azure.com/<organization>" [url "git@ssh.dev.azure.com:v3"]<br/>

insteadOf = https://dev.azure.com
⚡ What I Used for Private Org git config --global url."git@ssh.dev.azure.com:v3/<organization>/".insteadOf "https://dev.azure.com/ [url "git@ssh.dev.azure.com:v3/<organization>/"]

insteadOf = https://dev.azure.com/

{{< admonition type="Info" title="Organization in Dependency Path" open="true">}}

This changes the path for dependencies to not require the organization in the dependency path. Instead, the import path will look like this: import "dev.azure.com/<project>/repo.git/subdirectory"

{{< /admonition >}}

HTTPS

If you don't have restrictions on this, then you can do https with the following command to add the token in or use a more complex credential manager based process.

git config --global url."https://anythinggoeshere:$AZURE_DEVOPS_TOKEN@dev.azure.com".insteadOf "https://dev.azure.com"

Azure Pipelines

If you run into timeout issues with go get, I found this solution worked well.

I provided ORGANIZATION as a value if you are on the legacy url scheme, it's easier to just set this as variable and not worry about parsing out the org name itself from the url to place it in there. I got stuck on this recently and was pointed to the answer in this great article Using Go Modules With Private Azure Devops Repositories.

parameters:
  - name: workingDirectory
    type: string
    default: $(Pipeline.Workspace)

variables:
    - name: ORGANIZATION
      value: myorg
steps:
- checkout: self
  fetchDepth: 0
  path: $(Build.Repository.Name) # Note: you'll want to provide workingdirectory inputs for tasks if you have multi-repo checkout going on.
- pwsh: |
    git clone "https://$(ORGANIZATION):$(System.AccessToken)@dev.azure.com/$(ORGANIZATION)/$(System.TeamProject)/_git/$(Build.Repository.Name)"
  displayName: git-checkout-with-pat
# internal modules with go-get might fail without this.
- pwsh: |
    git config --global url."https://$(ORGANIZATION):$(System.AccessToken)@dev.azure.com".insteadOf "https://dev.azure.com"
  displayName: ensure-system-token-used-for-other-internal-repos
- pwsh: |
    Write-Host "example, with working directory set"
  displayName: exampleTask
  workingDirectory: ${{ parameters.workingDirectory }}/$(Build.Repository.Name)

Other References

  • SSH key usage in Azure Pipelines3.
  • Using with docker2

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 --rm -p 4004:4004 -v ${PWD}:/opt/adr trivadis/log4brains and open http://127.0.0.1:4004

# Proposal To Write a Microblog Post on ADRS

- Status: proposed
- Approver: Me
- Tags: microblog,hugo,magic

## Context and Problem Statement

Overally inhibiting view on tacos is preventing continual tacoops from meeting required SLA.

## Decision

- Tacos for everyone. 🌮

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.

{{< admonition type="Note" title="My Background" open="true">}}

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

I've been a Database Developer, Production DBA, Cloud Engineer, and other odd hats.

Some of my perspectives is different from the roles I've been involved in.

{{< /admonition >}}

Agree 👍

If I'm awaken at 2am from being on-call for more than once per quarter, then something is seriously wrong and I will either fix it or quit.

I agree you fix it! I believe in continual refactoring and improvement, applying Site Reliability Engineering principles. Don't kick the can down the street. Own it!

For beginners, the most lucrative programming language to learn is SQL.

Agree, it's a solid start and often can be done if you are working in a non-engineer role to bring value immediately to your company.

Paying for classes, books, conferences is worth it.

A caveat: a company should invest in the development of their employees, so try to leverage those benefits first.

If people are trying to assign blame to a bug or outage, it's time to move on.

If this is a routine occurrence, heck yes. Sometimes you can't help but run into politics.

I love drinking with my co-workers during happy hour. I'd rather spend time with kids, family, or friends.

Agreed. On this topic, companies shouldn't schedule team/company events in employees' off time. Schedule it during work hours. Don't impact their family.

The best demonstration of great leadership is when my leader took the fall for a mistake that was 100% my fault. You better believe I would've walked over fire for her.

100% agree. My first week at one of my roles, I broke internalization and required the team to deploy a hotfix to clients overseas. Release manager protected me during calls and said we had a fix in place. No blame. I stayed 7 years and would have done almost anything for that release manager.

* those devops guys and gals are* smart. At least those mofos get paid though.

😊 We are making it up just like anyone else, but have to have flexibility in learning and change due to the wide range of things to learn. Despite focusing on a role in Backend Engineering now, I'm incredibly grateful to have worked in a Development Operations team and see growth with my ability to handle pressure, cross-functional communication, and wide range of technology exposure.

AWS is hard.

Linux is important even when I was working in all Windows. Why? Because I eventually worked in Linux. So happy for those weekend where I screwed around installing Arch.

True. I wish I had started early. There is a career in purely Windows-based development, but I'd tell anyone starting out, it's better to start with Linux as a choice if possible. It feels so much simpler overall than Windows with all its API-based management, registry, and lots of complexity overall.

I don't know why I siked myself out for so long. Linux feels natural as I'm immersed in it more.

I've learned to be wary for ambiguous buzz words like big data.

Agreed. My inner geek want to play with ML. My engineer side questions the value for ML in normal enterprise work. It brings value, but I'd lean towards thinking the majority of businesses not specifically doing large amounts of analytics as a core business aren't going to find quick value from the magic 8 ball.

See Machine Learning Is A Marvelously Executed Scam

Disagree 👎

When I first started, I was enamored with technology and programming and computer science. I'm over it.

I still love tech. I think the tendency to tinker and experiment is just in my dna.

The most underrated skill to learn as an engineer is how to document.

I wish this was true. In my experience, the documentation I've written hasn't brought the value and recognization I thought it would, if the culture doesn't prize this.

I still write & blog, but unless the work culture supports reading first then meeting on something, I've found it's not given the priority it deserves.

The older I get, the more I appreciate dynamic languages. ****, I said it. Fight me.

I started with dynamic languages. Having started with Go in the last year, I'm finding a happy medium, and seeing that it presents a good development experience. I'd lean towards something like Go now, even for automation oriented work when possible. Seriously, I've lost so many hours with stupid typo & type issues in languages like PowerShell

I'm slowly gravitating towards Go for most work, though its verbosity can be annoying compared to a quick PowerShell one-liner.

Titles mostly don't matter. Principal Distinguished Staff Lead Engineer from Whatever Company, whatever. What did you do and what did you accomplish. That's all people care about.

Fellow engineers couldn't care less about your title. Titles matter to HR when dealing with compensation and determining rates, so don't ignore how important they are outside of the actual job role.

Last Thoughts

Compiling some principles and thoughts on my experiences could be a good way to think through key areas I've improved over the years, so I'll probably take a swing at creating my own "Career Advice to Myself" post. TBD

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 like this:

"gremlins.characters": {
    "0080-00FF": {
        "level": "error",
        "zeroWidth": false,
        "description": "Latin-1 Supplement character identified",
        "overviewRulerColor": "rgba(255,127,80,1)",
    },
}

I submitted this as a PR to project repo but figured I'd document here as well in case it takes a while to get merged.

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.

{{< youtube XlgqZeeoOtI >}}

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.