Skip to content

Commit b574a79

Browse files
committed
SNOW-1825790 Implement safer file based token cache
1 parent f388736 commit b574a79

5 files changed

+562
-132
lines changed

os_specific_posix.go

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//go:build darwin || linux
2+
3+
package gosnowflake
4+
5+
import (
6+
"fmt"
7+
"os"
8+
"syscall"
9+
)
10+
11+
func provideFileOwner(filepath string) (uint32, error) {
12+
info, err := os.Stat(filepath)
13+
if err != nil {
14+
return 0, err
15+
}
16+
nativeStat, ok := info.Sys().(*syscall.Stat_t)
17+
if !ok {
18+
return 0, fmt.Errorf("cannot cast file info for %v to *syscall.Stat_t", filepath)
19+
}
20+
return nativeStat.Uid, nil
21+
}

os_specific_windows.go

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// go:build windows
2+
3+
package gosnowflake
4+
5+
import "errors"
6+
7+
func provideFileOwner(filepath string) (uint32, error) {
8+
return 0, errors.New("provideFileOwner is unsupported on windows")
9+
}

0 commit comments

Comments
 (0)