You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: lock.go
    path of file: ./repos/portmaster/cmds/portmaster-start
    
    the code of the file until where you have to start completion: package main

import (
	"errors"
	"fmt"
	"io/fs"
	"log"
	"os"
	"os/user"
	"path/filepath"
	"strconv"
	"strings"

	processInfo "github.com/shirou/gopsutil/process"
)

func checkAndCreateInstanceLock(path, name string, pe
    
func getLockFilePath(path, name string, perUser bool) string {
	if !perUser {
		return filepath.Join(dataRoot.Path, path, fmt.Sprintf("%s-lock.pid", name))
	}

	// Get user ID for per-user lock file.
	var userID string
	usr, err := user.Current()
	if err != nil {
		log.Printf("failed to get current user: %s\n", err)
		userID = "no-user"
	} else {
		userID = usr.Uid
	}
	return filepath.Join(dataRoot.Path, path, fmt.Sprintf("%s-%s-lock.pid", name, userID))
}