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: scan.go
    path of file: ./repos/osmedeus/distribute
    
    the code of the file until where you have to start completion: package distribute

import (
	"fmt"
	"path"
	"strings"
	"time"

	"github.com/fatih/color"
	"github.com/j3ssie/osmedeus/core"
	"github.com/j3ssie/osmedeus/libs"
	"github.com/j3ssie/osmedeus/provider"
	"github.com/j3ssie/osmedeus/utils"
)

func (c *CloudRunner) PrepareInput() {
	c.Opt.Scan.ROptions = c.Target
	c.Opt.Scan.Flow = "cloud-distributed"
	//database.NewScan(c.Opt, "cli")
	c.Input = c.Target["Target"]
	runner, err := core.InitRunner(c.Input, c.Opt)
	if err == nil {
		c.Runner = runner
		c.Runner.RunnerType = "cloud"
	}

	// for creating local DB record
	if c.Opt.Cloud.Flow != "" {
		c.TaskName = c.Opt.Cloud.Flow
		c.TaskType = "flow"
	} else {
		c.TaskName = c.Opt.Cloud.Flow
		c.TaskType = "module"
	}
	c.CloudMoreParams()
	// more params from -p flag
	if len(c.Opt.Cloud.Params) > 0 {
		params := core.ParseParams(c.Opt.Cloud.Params)
		if len(params) > 0 {
			for k, v := range params {
				v = core.ResolveData(v, c.Target)
				c.Target[k] = v
			}
		}
	}

}

func (c *CloudRunner) StartScan() error {
	c.DBNewTarget()
	// c.DBNewScanLocal()
	// c.DBNewCloudInstance()

	err := c.RunScan()
	if err != nil {
		return fmt.Errorf("error to
    
func (c *CloudRunner) CheckingDone() error {
	if c.Opt.Cloud.NoDelete {
		time.Sleep(60 * time.Second)
		return nil
	}
	utils.InforF("Checking scan process at: %s", color.HiBlueString(c.PublicIP))

	// dest := fmt.Sprintf("%s/.%s/workspaces/%s/done", c.BasePath, libs.BINARY, c.Target["Workspace"])
	// @NOTE: this is new workspaces folder
	dest := fmt.Sprintf("%s/workspaces-%s/%s/done", c.BasePath, libs.BINARY, c.Target["Workspace"])

	cmd := fmt.Sprintf("file %s", dest)
	out, _ := c.SSHExec(cmd)

	if strings.Contains(out, "ASCII text") || strings.Contains(out, "JSON data") {
		return nil
	}

	waitTime := utils.CalcTimeout(c.Opt.Cloud.ClearTime)
	counter := 1
	for {
		time.Sleep(time.Duration(waitTime) * time.Second)
		out, _ = c.SSHExec(cmd)
		if strings.Contains(out, "ASCII text") || strings.Contains(out, "JSON data") {
			utils.InforF("The scan is done at: %s", color.HiBlueString(c.PublicIP))
			return nil
		}

		if !c.IsRunning() {
			return fmt.Errorf("no process running at %v", c.PublicIP)
		}

		// check if we have panic or not
		if c.IsPanic() {
			return fmt.Errorf("panic detected at %v", c.PublicIP)
		}

		if counter%50 == 0 {
			c.SyncResult()
		}
		counter++
	}
}