func UserRoot() string {
	xdgDataHome := os.Getenv("XDG_DATA_HOME")
	if xdgDataHome != "" {
		dirs := strings.Split(xdgDataHome, ":")
		return filepath.Join(dirs[0], "buildkit")
	}
	home := os.Getenv("HOME")
	if home != "" {
		return filepath.Join(home, ".local", "share", "buildkit")
	}
	return Root
}
UserRoot typically returns /home/$USER/.local/share/buildkit
package appdefaults
import (
	"os"
	"path/filepath"
	"strings"
)
const (
	Address = "unix:///run/buildkit/buildkitd.sock"
	Root    = "/var/lib/buildkit"
)
func UserAddress() string {
	xdgRuntimeDir := os.Getenv("XDG_RUNTIME_DIR")
	if xdgRuntimeDir != "" {
		dirs := strings.Split(xdgRuntimeDir, ":")
		return "unix://" + filepath.Join(dirs[0], "buildkit", "buildkitd.sock")
	}
	return Address
}
func EnsureUserAddressDir() error {
	xdgRuntimeDir := os.Getenv("XDG_RUNTIME_DIR")
	if xdgRuntimeDir != "" {
		dirs := strings.Split(xdgRuntimeDir, ":")
		dir := filepath.Join(dirs[0], "buildkit")
		if err := os.MkdirAll(dir, 0700); err != nil {
			return err
		}
		return os.Chmod(dir, 0700|os.ModeSticky)
	}
	return nil
}