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: main.go
    path of file: ./repos/client/go/tools/sigchain
    
    the code of the file until where you have to start completion: package main

import (
	"flag"
	"fmt"
	"io"
	"log"
	"os"
	"runtime"
	"runtime/pprof"
	"time"

	"github.com/keybase/client/go/libkb"
	"github.com/keybase/client/go/logger"
	"github.com/keybase/client/go/protocol/keybase1"
)

var uid = flag.String("uid", "", "uid of sigchain owner")
var username = flag.String("username", "", "username of sigchain owner")
var cpuprofile = flag.String("cpuprofile", "", "write cpu profile to file")

func errout(msg string) {
	fmt.Fprintf(os.Stderr, msg+"\n")
	os.Exit(1)
}

func read() []byte {
	var in io.Reader
	switch flag.NArg() {
	case 0:
		fmt.Println("reading sigchain from stdin")
		in = os.Stdin
	case 1:
		fmt.Printf("reading sigchain from %q\n", flag.Arg(0))
		f, err := os.Open(flag.Arg(0))
		if err != nil {
			errout(err.Error())
		}
		defer f.Close()
		in = f
	default:
		errout("provide 0 or 1 args")
	}

	all, err := io.ReadAll(in)
	if err != nil {
		errout(err.Error())
	}
	fmt.Printf("%d bytes read\n",
    
func main() {
	fmt.Println("sigchain loader")
	flag.Parse()
	raw := read()

	g := libkb.NewGlobalContext().Init()
	g.Log = logger.New("sc")
	if err := g.ConfigureCaches(); err != nil {
		errout(err.Error())
	}

	iterations := 1
	if *cpuprofile != "" {
		f, err := os.Create(*cpuprofile)
		if err != nil {
			log.Fatal(err)
		}
		if err := pprof.StartCPUProfile(f); err != nil {
			errout(err.Error())
		}
		defer pprof.StopCPUProfile()

		iterations = 10
	}

	m := libkb.NewMetaContextBackground(g)

	for i := 0; i < iterations; i++ {
		start := time.Now()
		sc = &libkb.SigChain{Contextified: libkb.NewContextified(g)}
		sc.SetUIDUsername(keybase1.UID(*uid), *username)
		if _, err := sc.LoadServerBody(m, raw, 0, nil, ""); err != nil {
			errout(err.Error())
		}

		if err := sc.VerifyChain(m, keybase1.UID(*uid)); err != nil {
			errout(err.Error())
		}

		if err := sc.Store(m); err != nil {
			errout(err.Error())
		}
		elapsed := time.Since(start)
		fmt.Printf("sig chain load time: %s\n", elapsed)
	}

	memstats()
	memprof()
}