diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index e5a327909d..4d2fcdb0e2 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -1071,10 +1071,6 @@ jobs:
         uses: actions/setup-go@v5
         with:
           go-version: "^1.22"
-      - name: Set GOROOT
-        id: goroot
-        if: needs.file-check.outputs.run == 'true'
-        run: Add-Content -Path "$env:GITHUB_ENV" -Value "GOROOT=$(go.exe env GOROOT)"
       - name: Set Up Dependencies
         id: deps
         if: needs.file-check.outputs.run == 'true'
diff --git a/packaging/cmake/Modules/FindGo.cmake b/packaging/cmake/Modules/FindGo.cmake
index e282a10fcb..69e23fda67 100644
--- a/packaging/cmake/Modules/FindGo.cmake
+++ b/packaging/cmake/Modules/FindGo.cmake
@@ -21,11 +21,12 @@ endif()
 # and fall back to looking in PATH. For the specific case of MSYS2, we prefer a Windows install over an MSYS2 install.
 if(DEFINED $ENV{GOROOT})
   find_program(GO_EXECUTABLE go PATHS "$ENV{GOROOT}/bin" DOC "Go toolchain" NO_DEFAULT_PATH)
+  set(GO_ROOT $ENV{GOROOT})
 elseif(OS_WINDOWS)
   if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
     find_program(GO_EXECUTABLE go PATHS C:/go/bin "C:/Program Files/go/bin" DOC "Go toolchain" NO_DEFAULT_PATH)
   else()
-    find_program(GO_EXECUTABLE go PATHS /c/go/bin "/c/Program Files/go/bin" /mingw64/bin /ucrt64/bin /clang64/bin DOC "Go toolchain" NO_DEFAULT_PATH)
+    find_program(GO_EXECUTABLE go PATHS /c/go/bin "/c/Program Files/go/bin" /mingw64/lib/go/bin /ucrt64/lib/go/bin /clang64/lib/go/bin DOC "Go toolchain" NO_DEFAULT_PATH)
   endif()
 else()
   find_program(GO_EXECUTABLE go PATHS /usr/local/go/bin DOC "Go toolchain" NO_DEFAULT_PATH)
@@ -41,12 +42,27 @@ if (GO_EXECUTABLE)
   if (RESULT EQUAL 0)
     string(REGEX MATCH "go([0-9]+\\.[0-9]+(\\.[0-9]+)?)" GO_VERSION_STRING "${GO_VERSION_STRING}")
     string(REGEX MATCH "([0-9]+\\.[0-9]+(\\.[0-9]+)?)" GO_VERSION_STRING "${GO_VERSION_STRING}")
+  else()
+    unset(GO_VERSION_STRING)
+  endif()
+
+  if(NOT DEFINED GO_ROOT)
+    execute_process(
+      COMMAND ${GO_EXECUTABLE} env GOROOT
+      OUTPUT_VARIABLE GO_ROOT
+      RESULT_VARIABLE RESULT
+    )
+    if(RESULT EQUAL 0)
+      string(REGEX REPLACE "\n$" "" GO_ROOT "${GO_ROOT}")
+    else()
+      unset(GO_ROOT)
+    endif()
   endif()
 endif()
 
 include(FindPackageHandleStandardArgs)
 find_package_handle_standard_args(
     Go
-    REQUIRED_VARS GO_EXECUTABLE
+    REQUIRED_VARS GO_EXECUTABLE GO_ROOT
     VERSION_VAR GO_VERSION_STRING
 )
diff --git a/packaging/cmake/Modules/NetdataGoTools.cmake b/packaging/cmake/Modules/NetdataGoTools.cmake
index 3e249c7c9c..c8b8b9c013 100644
--- a/packaging/cmake/Modules/NetdataGoTools.cmake
+++ b/packaging/cmake/Modules/NetdataGoTools.cmake
@@ -33,7 +33,7 @@ macro(add_go_target target output build_src build_dir)
 
     add_custom_command(
         OUTPUT ${output}
-        COMMAND "${CMAKE_COMMAND}" -E env CGO_ENABLED=0 GOPROXY=https://proxy.golang.org,direct "${GO_EXECUTABLE}" build -buildvcs=false -ldflags "${GO_LDFLAGS}" -o "${CMAKE_BINARY_DIR}/${output}" "./${build_dir}"
+        COMMAND "${CMAKE_COMMAND}" -E env GOROOT=${GO_ROOT} CGO_ENABLED=0 GOPROXY=https://proxy.golang.org,direct "${GO_EXECUTABLE}" build -buildvcs=false -ldflags "${GO_LDFLAGS}" -o "${CMAKE_BINARY_DIR}/${output}" "./${build_dir}"
         DEPENDS ${${target}_DEPS}
         COMMENT "Building Go component ${output}"
         WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/${build_src}"