func Load(cfg *Config, patterns ...string) ([]*Package, error) {
	l := newLoader(cfg)
	response, err := defaultDriver(&l.Config, patterns...)
	if err != nil {
		return nil, err
	}
	l.sizes = response.Sizes
	return l.refine(response.Roots, response.Packages...)
}
Load loads and returns the Go packages named by the given patterns.

Config specifies loading options;
nil behaves the same as an empty Config.

Load returns an error if any of the patterns was invalid
as defined by the underlying build system.
It may return an empty list of packages without an error,
for instance for an empty expansion of a valid wildcard.
Errors associated with a particular package are recorded in the
corresponding Package's Errors list, and do not cause Load to
return an error. Clients may need to handle such errors before
proceeding with further analysis. The PrintErrors function is
provided for convenient display of all errors.
package packages
import (
	"context"
	"encoding/json"
	"fmt"
	"go/ast"
	"go/parser"
	"go/scanner"
	"go/token"
	"go/types"
	"io/ioutil"
	"log"
	"os"
	"path/filepath"
	"strings"
	"sync"
	"time"
	"golang.org/x/tools/go/gcexportdata"
	"golang.org/x/tools/internal/gocommand"
	"golang.org/x/tools/internal/packagesinternal"
	"golang.org/x/tools/internal/typesinternal"
)
type LoadMode int
const (
	NeedName LoadMode = 1 << iota
	NeedFiles
	NeedCompiledGoFiles
	NeedImports
	NeedDeps
	NeedExportsFile
	NeedTypes
	NeedSyntax
	NeedTypesInfo
	NeedTypesSizes
	typecheckCgo
	NeedModule
)
const (
	LoadFiles = NeedName | NeedFiles | NeedCompiledGoFiles
	LoadImports = LoadFiles | NeedImports
	LoadTypes = LoadImports | NeedTypes | NeedTypesSizes
	LoadSyntax = LoadTypes | NeedSyntax | NeedTypesInfo
	LoadAllSyntax = LoadSyntax | NeedDeps
)
type Config struct {
	Mode LoadMode
	Context context.Context
	Logf func(format string, args ...interface{})
	Dir string
	Env []string
	gocmdRunner *gocommand.Runner
	BuildFlags []string
	modFile string
	modFlag string
	Fset *token.FileSet
	ParseFile func(fset *token.FileSet, filename string, src []byte) (*ast.File, error)
	Tests bool
	Overlay map[string][]byte
}
type driver func(cfg *Config, patterns ...string) (*driverResponse, error)
type driverResponse struct {
	NotHandled bool
	Sizes *types.StdSizes
	Roots []string `json:",omitempty"`
	Packages []*Package
}