GitLab CI Warning: "git": executable file not found in $PATH

WARNING: current commit information was not captured by the build: git was not found in the system: exec: "git": executable file not found in $PATH

I saw this WARNING sail by while I was watching a Docker build process run on my GitLab CI pipeline. The build wasn’t failing but wasn’t completing cleanly. The GitLab runner image being used for this pipeline was:

image: python:3.9-slim

The solve came after a bit of experimentation and found that I needed to edit my .gitlab-ci.yml file to include the following:

before_script:
  - apk add --update --no-cache git

That edit solved the Warning and cleaned up the pipeline. Noted.

GoLand: File is not `goimports`-ed (goimports)

Had a bit of a head scratcher when I was linting my Go code with golangci-lint. I was getting the following error:

File is not `goimports`-ed (goimports)

After checking for formatting errors (tabs v spaces) and running fmt I found this setting in GoLand which solved the issue (it reorganizes your import section).

All you need to do is set the Sorting type to goimports and you’ll be golden.