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: cmd_run.go
    path of file: ./repos/gf/cmd/gf/internal/cmd
    
    the code of the file until where you have to start completion: // Copyright GoFrame gf Author(https://goframe.org). All Rights Reserved
//
// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT was not distributed with this file,
// You can obtain one at https://github.com/gogf/gf.

package cmd

import (
	"context"
	"fmt"
	"path/filepath"
	"runtime"
	"strings"

	"github.com/gogf/gf/v2/container/gtype"
	"github.com/gogf/gf/v2/frame/g"
	"github.com/gogf/gf/v2/os/gfile"
	"github.com/gogf/gf/v2/os/gfsnotify"
	"github.com/gogf/gf/v2/os/gproc"
	"github.com/gogf/gf/
    
func (c cRun) Index(ctx context.Context, in cRunInput) (out *cRunOutput, err error) {
	// Necessary check.
	if gproc.SearchBinary("go") == "" {
		mlog.Fatalf(`command "go" not found in your environment, please install golang first to proceed this command`)
	}

	if len(in.WatchPaths) == 1 {
		in.WatchPaths = strings.Split(in.WatchPaths[0], ",")
		mlog.Printf("watchPaths: %v", in.WatchPaths)
	}

	app := &cRunApp{
		File:       in.File,
		Path:       in.Path,
		Options:    in.Extra,
		Args:       in.Args,
		WatchPaths: in.WatchPaths,
	}
	dirty := gtype.NewBool()

	callbackFunc := func(event *gfsnotify.Event) {
		if gfile.ExtName(event.Path) != "go" {
			return
		}

		// Variable `dirty` is used for running the changes only one in one second.
		if !dirty.Cas(false, true) {
			return
		}

		// With some delay in case of multiple code changes in very short interval.
		gtimer.SetTimeout(ctx, 1500*gtime.MS, func(ctx context.Context) {
			defer dirty.Set(false)
			mlog.Printf(`watched file changes: %s`, event.String())
			app.Run(ctx)
		})
	}

	if len(app.WatchPaths) > 0 {
		for _, path := range app.WatchPaths {
			_, err = gfsnotify.Add(gfile.RealPath(path), callbackFunc)
			if err != nil {
				mlog.Fatal(err)
			}
		}
	} else {
		_, err = gfsnotify.Add(gfile.RealPath("."), callbackFunc)
		if err != nil {
			mlog.Fatal(err)
		}
	}

	go app.Run(ctx)
	select {}
}