Using Renovate to manage updates to golangci-lint
versions
Although I used to recommend using a tools.go
to track the dependency versions for golangci-lint
, I've since learned why it's not the recommended route, and have gone back to the official install instructions.
With the official install, you use a shell script to download this, which means you'll have, presumably in a Makefile
:
$(GOBIN)/golangci-lint:
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOBIN) v1.50.1
However, with me recently using Renovate for dependency management, I've been disappointed by not being able to keep up-to-date with version upgrades automagically with this way of installing golangci-lint
, or at least so I thought
While looking through some unrelated things in the Renovate docs, I discovered the custom regex manager for dependencies, which means we can write the following Renovate configuration:
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"regexManagers": [
{
"fileMatch": ["^Makefile$"],
"matchStrings": [
"curl .*https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- .* (?<currentValue>.*?)\\n"
],
"depNameTemplate": "github.com/golangci/golangci-lint",
"datasourceTemplate": "go"
}
]
}
This allows us to use golangci-lint
's dependency data from Renovate, and performs an in-place update for the dependency as and when it's updated - awesome π