From 94382cf25f551eeea9cf295209c880dd1678f052 Mon Sep 17 00:00:00 2001 From: Michele Giornetta Date: Wed, 27 May 2026 16:24:08 +0200 Subject: [PATCH] fix: use build version for API client user agent Stops the per-command GitHub releases API call in CivoAPIClient that caused rate limiting (#313), and reports the running version instead of the latest release tag. --- config/config.go | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/config/config.go b/config/config.go index 5c9bb58f..a36746b8 100644 --- a/config/config.go +++ b/config/config.go @@ -269,20 +269,11 @@ func CivoAPIClient() (*civogo.Client, error) { return nil, err } - var version string - res, skip := common.VersionCheck(common.GithubClient()) - if !skip { - version = *res.TagName - } else { - version = "0.0.0" - } - - // Update the user agent to include the version of the CLI - cliComponent := &civogo.Component{ + // Set the user agent to the running CLI version (injected at build time via ldflags) + cliClient.SetUserAgent(&civogo.Component{ Name: "civo-cli", - Version: version, - } - cliClient.SetUserAgent(cliComponent) + Version: common.VersionCli, + }) return cliClient, nil }