Using Renovate to manage updates to golangci-lint versions

Featured image for sharing metadata for article

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 πŸ™Œ

Written by Jamie Tanna's profile image Jamie Tanna on , and last updated on .

Content for this article is shared under the terms of the Creative Commons Attribution Non Commercial Share Alike 4.0 International, and code is shared under the Apache License 2.0.

#blogumentation #renovate #go.

Also on:

This post was filed under articles.

Interactions with this post

Interactions with this post

Below you can find the interactions that this page has had using WebMention.

Have you written a response to this post? Let me know the URL:

Do you not have a website set up with WebMention capabilities? You can use Comment Parade.