Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"encoding/json"
"errors"
"fmt"
"github.com/snowflakedb/gosnowflake/internal/cgo"
"io"
"net/http"
"net/url"
Expand Down Expand Up @@ -187,6 +188,7 @@ type authRequestClientEnvironment struct {
CoreVersion string `json:"CORE_VERSION,omitempty"`
CoreLoadError string `json:"CORE_LOAD_ERROR,omitempty"`
CoreFileName string `json:"CORE_FILE_NAME,omitempty"`
CgoEnabled bool `json:"CGO_ENABLED,omitempty"`
}

type authRequestData struct {
Expand Down Expand Up @@ -482,6 +484,7 @@ func newAuthRequestClientEnvironment() authRequestClientEnvironment {
CoreVersion: coreVersion,
CoreFileName: getMiniCoreFileName(),
CoreLoadError: coreLoadError,
CgoEnabled: cgo.Enabled,
}
}

Expand Down
6 changes: 6 additions & 0 deletions internal/cgo/cgo_disabled.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
//go:build !cgo

package cgo

// Enabled is set to true if CGO is enabled.
var Enabled = false
6 changes: 6 additions & 0 deletions internal/cgo/cgo_enabled.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
//go:build cgo

package cgo

// Enabled is set to true if CGO is enabled.
var Enabled = true
2 changes: 2 additions & 0 deletions minicore.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package gosnowflake
import (
"bufio"
"fmt"
"github.com/snowflakedb/gosnowflake/internal/cgo"
"os"
"path/filepath"
"runtime"
Expand Down Expand Up @@ -286,6 +287,7 @@ func (l *miniCoreLoaderType) writeLibraryToFile() (minicoreDirCandidate, string,
// getMiniCore returns the minicore instance, loading it asynchronously if needed.
func getMiniCore() miniCore {
miniCoreOnce.Do(func() {
minicoreDebugf("cgo enabled: %v", cgo.Enabled)
if strings.EqualFold(os.Getenv(disableMinicoreEnv), "true") {
logger.Debugf("minicore loading disabled")
return
Expand Down
Loading