Import a package
pkg, err := build.Import("net/http", "", 0)
if err != nil { log.Fatal(err) }
fmt.Println(pkg.Dir, pkg.GoFiles)
go/buildResolve a Go package on disk given GOPATH/GOROOT, its import path, and the current build context (GOOS, GOARCH, tags).
pkg, err := build.Import("net/http", "", 0)
if err != nil { log.Fatal(err) }
fmt.Println(pkg.Dir, pkg.GoFiles)
ctx := build.Default
ctx.GOOS = "linux"
ctx.GOARCH = "arm64"
ctx.BuildTags = []string{"integration"}
pkg, _ := ctx.Import("myapp/internal/worker", ".", 0)