func ParseFile(source string) (*model.Package, error) {
	fs := token.NewFileSet()
	file, err := parser.ParseFile(fs, source, nil, 0)
	if err != nil {
		return nil, fmt.Errorf("failed parsing source file %v: %v", source, err)
	}
	p := &fileParser{
		fileSet:       fs,
		imports:       make(map[string]string),
		auxInterfaces: make(map[string]map[string]*ast.InterfaceType),
	}
	dotImports := make(map[string]bool)
	if *imports != "" {
		for _, kv := range strings.Split(*imports, ",") {
			eq := strings.Index(kv, "=")
			k, v := kv[:eq], kv[eq+1:]
			if k == "." {
				dotImports[v] = true
			} else {
				p.imports[k] = v
			}
		}
	}
	if err := p.parseAuxFiles(*auxFiles); err != nil {
		return nil, err
	}
	p.addAuxInterfacesFromFile("", file)  
	pkg, err := p.parseFile(file)
	if err != nil {
		return nil, err
	}
	pkg.DotImports = make([]string, 0, len(dotImports))
	for path := range dotImports {
		pkg.DotImports = append(pkg.DotImports, path)
	}
	return pkg, nil
}
TODO: simplify error reporting
package gomock
import (
	"flag"
	"fmt"
	"go/ast"
	"go/parser"
	"go/token"
	"log"
	"path"
	"strconv"
	"strings"
	"github.com/petergtz/pegomock/model"
)
var (
	imports  = flag.String("imports", "", "(source mode) Comma-separated name=path pairs of explicit imports to use.")
	auxFiles = flag.String("aux_files", "", "(source mode) Comma-separated pkg=path pairs of auxiliary Go source files.")
)