コード例 #1
0
ファイル: common.go プロジェクト: gozes/kbfs-beta
// NewContextWithOpID adds a unique ID to this context, identifying
// a particular request.
func NewContextWithOpID(ctx context.Context,
	log logger.Logger) context.Context {
	if runtime.GOOS == "darwin" {
		// Timeout operations before they hit the osxfuse time limit,
		// so we don't hose the entire mount.  The timeout is 60
		// seconds, but it looks like sometimes it tries multiple
		// attempts within that 60 seconds, so let's go a little under
		// 60/3 to be safe.
		ctx, _ = context.WithTimeout(ctx, 19*time.Second)
	}
	id, err := libkbfs.MakeRandomRequestID()
	if err != nil {
		log.Errorf("Couldn't make request ID: %v", err)
		return ctx
	}
	return context.WithValue(ctx, CtxIDKey, id)
}
コード例 #2
0
ファイル: main.go プロジェクト: mark-adams/client
func checkSystemUser(log logger.Logger) {
	if isAdminUser, match, _ := libkb.IsSystemAdminUser(); isAdminUser {
		log.Errorf("Oops, you are trying to run as an admin user (%s). This isn't supported.", match)
		os.Exit(int(keybase1.ExitCode_NOTOK))
	}
}