Skip to content

Commit db98371

Browse files
committed
SNOW-2465270 Add CGO_ENABLED marker to telemetry
1 parent 3caf078 commit db98371

File tree

4 files changed

+17
-0
lines changed

4 files changed

+17
-0
lines changed

auth.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"encoding/json"
99
"errors"
1010
"fmt"
11+
"github.com/snowflakedb/gosnowflake/internal/cgo"
1112
"io"
1213
"net/http"
1314
"net/url"
@@ -187,6 +188,7 @@ type authRequestClientEnvironment struct {
187188
CoreVersion string `json:"CORE_VERSION,omitempty"`
188189
CoreLoadError string `json:"CORE_LOAD_ERROR,omitempty"`
189190
CoreFileName string `json:"CORE_FILE_NAME,omitempty"`
191+
CgoEnabled bool `json:"CGO_ENABLED,omitempty"`
190192
}
191193

192194
type authRequestData struct {
@@ -482,6 +484,7 @@ func newAuthRequestClientEnvironment() authRequestClientEnvironment {
482484
CoreVersion: coreVersion,
483485
CoreFileName: getMiniCoreFileName(),
484486
CoreLoadError: coreLoadError,
487+
CgoEnabled: cgo.Enabled,
485488
}
486489
}
487490

internal/cgo/cgo_disabled.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
//go:build !cgo
2+
3+
package cgo
4+
5+
// Enabled is set to true if CGO is enabled.
6+
var Enabled = false

internal/cgo/cgo_enabled.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
//go:build cgo
2+
3+
package cgo
4+
5+
// Enabled is set to true if CGO is enabled.
6+
var Enabled = true

minicore.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package gosnowflake
33
import (
44
"bufio"
55
"fmt"
6+
"github.com/snowflakedb/gosnowflake/internal/cgo"
67
"os"
78
"path/filepath"
89
"runtime"
@@ -286,6 +287,7 @@ func (l *miniCoreLoaderType) writeLibraryToFile() (minicoreDirCandidate, string,
286287
// getMiniCore returns the minicore instance, loading it asynchronously if needed.
287288
func getMiniCore() miniCore {
288289
miniCoreOnce.Do(func() {
290+
minicoreDebugf("cgo enabled: %v", cgo.Enabled)
289291
if strings.EqualFold(os.Getenv(disableMinicoreEnv), "true") {
290292
logger.Debugf("minicore loading disabled")
291293
return

0 commit comments

Comments
 (0)