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: targets.go
    path of file: ./repos/scan4all/pkg/naabu/v2/pkg/runner
    
    the code of the file until where you have to start completion: package runner

import (
	"bufio"
	"flag"
	"fmt"
	"github.com/GhostTroops/scan4all/lib/util"
	"github.com/GhostTroops/scan4all/pkg"
	"github.com/GhostTroops/scan4all/pkg/hydra"
	"github.com/GhostTroops/scan4all/pkg/naabu/v2/pkg/privileges"
	"github.com/GhostTroops/scan4all/pkg/naabu/v2/pkg/scan"
	"github.com/GhostTroops/scan4all/projectdiscovery/dnsxx"
	"github.com/asaskevich/govalidator"
	"github.com/projectdiscovery/gologger"
	"github.com/projectdiscovery/iputil"
	"github.com/remeh/sizedwaitgroup"
	"io"
	"io/ioutil"
	"log"
	"net/url"
	"os"
	"regexp"
	"runtime"
	"strings"
)

func (r *Runner) Load() error {
	r.scanner.State = scan.Init

	// merge all target sources into a file
	targetfile, err := r.MergeToFile()
	if err != nil {
		return err
	}
	r.targetsFile = targetfile

	// pre-process all targets (resolves all non fqdn targets to ip ad
    
func (r *Runner) DoTargets() (bool, error) {
	data, err := ioutil.ReadFile(r.targetsFile)
	if err != nil {
		return false, err
	}
	aR := []string{}
	a := strings.Split(string(data), "\n")
	for _, x := range a {
		// fix 无效的空行
		if 3 > len(x) {
			continue
		}
		if govalidator.IsDNSName(x) {
			aR = r.DoDns001(x, aR)
		} else if govalidator.IsURL(x) {
			if x1, err := url.Parse(strings.TrimSpace(x)); nil == err {
				if govalidator.IsDNSName(x) {
					aR = r.DoDns001(x, aR)
				} else {
					if "" == x1.Hostname() {
						aR = append(aR, x)
					} else {
						aR = append(aR, x1.Hostname())
					}
					continue
				}
			}
		}
		aR = append(aR, x)
	}
	a = nil
	aR = util.RemoveDuplication_map(aR)
	//log.Printf("DoTargets:: %+v", aR)
	if "" != r.targetsFile {
		err = ioutil.WriteFile(r.targetsFile, []byte(strings.Join(aR, "\n")), os.ModePerm)
		if nil != err {
			log.Println("ioutil.WriteFile(r.targetsFile err: ", err)
		}
	}
	// 有nmap那么就直接调用nmap了
	bRw := false
	if util.CheckHvNmap() {
		bRw = true
		tempInput1, err := ioutil.TempFile("", "stdin-out-*")
		if err == nil {
			defer tempInput1.Close()
			s009 := "/config/doNmapScan.sh "
			if runtime.GOOS == "windows" {
				s009 = "/config/doNmapScanWin.bat "
			}
			x := util.SzPwd + s009 + r.targetsFile + " " + tempInput1.Name()
			//log.Println(x)
			ss, err := util.DoCmd(strings.Split(x, " ")...)
			s0 := tempInput1.Name()
			if nil == err {
				if "" != ss {
					//	log.Println(ss, "\n")
				}
				if util.FileExists(s0) {
					//data, err := tempInput1.Stat()
					//log.Println(tempInput1.Name(), " file size: ", data.Size())
					//if nil == err && 100 < data.Size() {
					if x99, ok := util.TmpFile[string(util.Naabu)]; ok && 0 < len(x99) {
						defer func(f09 *os.File) {
							f09.Close()
							os.RemoveAll(f09.Name())
						}(x99[0])
					}
					util.TmpFile[string(util.Naabu)] = []*os.File{tempInput1}
					log.Println("start parse nmap xml result")
					hydra.DoNmapRst(&Naabubuffer)
					defer r.Close()
					if "" != r.targetsFile {
						ioutil.WriteFile(r.targetsFile, []byte(""), os.ModePerm)
					}
					log.Println("do namp over naabu ")
					return true, nil
					//} else {
					//	log.Println("tempInput1.Stat: ", err)
					//}
				} else {
					log.Println("nmap 结果文件不存在")
				}
			} else {
				log.Println("DoCmd: ", err)
			}
		} else {
			log.Println("ioutil.TempFile ", err)
		}
	} else {
		log.Println(" pkg.CheckHvNmap() false")
	}
	if bRw && "" != r.targetsFile {
		ioutil.WriteFile(r.targetsFile, []byte(strings.Join(aR, "\n")), os.ModePerm)
	}
	return false, nil
}