From 9a8986893b8874c624844f123bc994f28f01607c Mon Sep 17 00:00:00 2001 From: sibicramesh Date: Thu, 1 Feb 2024 20:01:42 -0800 Subject: [PATCH] fix: sync --- core/core.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/core/core.go b/core/core.go index 4b372db8..ed742c1e 100644 --- a/core/core.go +++ b/core/core.go @@ -43,8 +43,7 @@ var ( // BazeliskVersion is filled in via x_defs when building a release. BazeliskVersion = "development" - fileConfig map[string]string - fileConfigOnce sync.Once + userAgentOnce sync.Once ) // ArgsFunc is a function that receives a resolved Bazel version and returns the arguments to invoke @@ -89,7 +88,10 @@ func RunBazeliskWithArgsFunc(argsFunc ArgsFunc, repos *Repositories) (int, error // RunBazeliskWithArgsFuncAndConfig runs the main Bazelisk logic for the given ArgsFunc and Bazel // repositories and config. func RunBazeliskWithArgsFuncAndConfig(argsFunc ArgsFunc, repos *Repositories, config config.Config) (int, error) { - httputil.UserAgent = getUserAgent(config) + + userAgentOnce.Do(func() { + httputil.UserAgent = getUserAgent(config) + }) bazeliskHome := config.Get("BAZELISK_HOME") if len(bazeliskHome) == 0 {