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: convert_runmount.go
    path of file: ./repos/buildkit/frontend/dockerfile/dockerfile2llb
    
    the code of the file until where you have to start completion: package dockerfile2llb

import (
	"context"
	"os"
	"path"
	"path/filepath"

	"github.com/moby/buildkit/client/llb"
	"github.com/moby/buildkit/frontend/dockerfile/instructions"
	"github.com/moby/buildkit/solver/pb"
	"github.com/pkg/errors"
)

func detectRunMount(cmd *command, allDispatchStates *dis
    
func detectRunMount(cmd *command, allDispatchStates *dispatchStates) bool {
	if c, ok := cmd.Command.(*instructions.RunCommand); ok {
		mounts := instructions.GetMounts(c)
		sources := make([]*dispatchState, len(mounts))
		for i, mount := range mounts {
			var from string
			if mount.From == "" {
				// this might not be accurate because the type might not have a real source (tmpfs for instance),
				// but since this is just for creating the sources map it should be ok (we don't want to check the value of
				// mount.Type because it might be a variable)
				from = emptyImageName
			} else {
				from = mount.From
			}
			stn, ok := allDispatchStates.findStateByName(from)
			if !ok {
				stn = &dispatchState{
					stage:        instructions.Stage{BaseName: from},
					deps:         make(map[*dispatchState]instructions.Command),
					paths:        make(map[string]struct{}),
					unregistered: true,
				}
			}
			sources[i] = stn
		}
		cmd.sources = sources
		return true
	}

	return false
}