// InterfaceImportPaths returns all packages imported by
// this resource interface file
329367
func (gr goResource) InterfaceImportPaths() []string {
	ip := map[string]struct{}{
		"net/http":               struct{}{},
		"github.com/gorilla/mux": struct{}{},
	}

	for _, gm := range gr.Methods {
		// if has middleware, we need to import middleware helper library
		if len(gm.Middlewares) > 0 {
			ip["github.com/justinas/alice"] = struct{}{}
		}
		for _, sb := range gm.SecuredBy {
			if lib := libImportPath(globRootImportPath, sb.Name, globLibRootURLs); lib != "" {
				ip[lib] = struct{}{}
			}
		}
	}
	// return sorted array for predictable order
	// we need it for unit test to always return same order
	return commons.MapToSortedStrings(ip)
}
1053873
func InitPaths() error {
	// Plugins dir
	if err := configs.EnsureBitriseConfigDirExists(); err != nil {
		log.Errorf("Failed to ensure bitrise configs dir, err: %s", err)
	}

	bitriseDir := configs.GetBitriseHomeDirPath()
	tmpPluginsDir := filepath.Join(bitriseDir, pluginsDirName)

	if err := pathutil.EnsureDirExist(tmpPluginsDir); err != nil {
		return err
	}

	pluginsDir = tmpPluginsDir

	// Plugins routing
	pluginsRoutingPth = filepath.Join(pluginsDir, pluginSpecFileName)

	return nil
}
273451
func appendImports(i, a []*ImportSpec) []*ImportSpec {
	for _, v := range a {
		contains := false
		for _, att := range i {
			if att.Path == v.Path {
				contains = true
				break
			}
		}
		if contains != true {
			i = append(i, v)
		}
	}
	return i
}
980493
func IsValidPath(importPath string) bool {
	return pathFlags[importPath]&packagePath != 0 ||
		pathFlags["vendor/"+importPath]&packagePath != 0 ||
		IsValidRemotePath(importPath)
}
1151288
func (i *ImportRestriction) ForbiddenImportsFor(pkg Package) ([]string, error) {
	if restricted, err := i.isRestrictedDir(pkg.Dir); err != nil {
		return []string{}, err
	} else if !restricted {
		return []string{}, nil
	}

	return i.forbiddenImportsFor(pkg), nil
}
1075088
func (d *Domain) ResolveImports() {
	for _, returns := range d.Commands {
		if returns.HasReturn {
			d.Imports = append(d.Imports, "encoding/json")
			return
		}
	}
}
197525
func (_m *APIClient) ImageImport(ctx context.Context, source types.ImageImportSource, ref string, options types.ImageImportOptions) (io.ReadCloser, error) {
	ret := _m.Called(ctx, source, ref, options)

	var r0 io.ReadCloser
	if rf, ok := ret.Get(0).(func(context.Context, types.ImageImportSource, string, types.ImageImportOptions) io.ReadCloser); ok {
		r0 = rf(ctx, source, ref, options)
	} else {
		if ret.Get(0) != nil {
			r0 = ret.Get(0).(io.ReadCloser)
		}
	}

	var r1 error
	if rf, ok := ret.Get(1).(func(context.Context, types.ImageImportSource, string, types.ImageImportOptions) error); ok {
		r1 = rf(ctx, source, ref, options)
	} else {
		r1 = ret.Error(1)
	}

	return r0, r1
}
546868
func (r Virtual_Disk_Image) GetImportedDiskType() (resp string, err error) {
	err = r.Session.DoRequest("SoftLayer_Virtual_Disk_Image", "getImportedDiskType", nil, &r.Options, &resp)
	return
}
533958
func (d *Domain) InterfaceStats(path string) (*DomainInterfaceStats, error) {
	cPath := C.CString(path)
	defer C.free(unsafe.Pointer(cPath))

	size := C.size_t(unsafe.Sizeof(C.struct__virDomainInterfaceStats{}))

	cStats := (C.virDomainInterfaceStatsPtr)(C.malloc(size))
	defer C.free(unsafe.Pointer(cStats))

	var err C.virError
	result := C.virDomainInterfaceStatsWrapper(d.ptr, cPath, (C.virDomainInterfaceStatsPtr)(cStats), size, &err)

	if result != 0 {
		return nil, makeError(&err)
	}
	return &DomainInterfaceStats{
		RxBytesSet:   true,
		RxBytes:      int64(cStats.rx_bytes),
		RxPacketsSet: true,
		RxPackets:    int64(cStats.rx_packets),
		RxErrsSet:    true,
		RxErrs:       int64(cStats.rx_errs),
		RxDropSet:    true,
		RxDrop:       int64(cStats.rx_drop),
		TxBytesSet:   true,
		TxBytes:      int64(cStats.tx_bytes),
		TxPacketsSet: true,
		TxPackets:    int64(cStats.tx_packets),
		TxErrsSet:    true,
		TxErrs:       int64(cStats.tx_errs),
		TxDropSet:    true,
		TxDrop:       int64(cStats.tx_drop),
	}, nil
}
1055801
func InterfaceIPs(device string) (ips []net.IP, _ error) {
	var networks []net.Addr

	if iface, err := net.InterfaceByName(device); err != nil {
		return nil, err
	} else if networks, err = iface.Addrs(); err != nil {
		return nil, err
	}

	for _, network := range networks {
		if ipNet, castable := network.(*net.IPNet); castable {
			ips = append(ips, ipNet.IP)
		}
	}

	// Note that on non-IP interfaces it will be an empty slice
	// and no error indicator. Maybe that's not super-perfect.
	return ips, nil
}
904702
func (v *Module) GetImportPath() (o string) {
	if v != nil {
		o = v.ImportPath
	}
	return
}
1325265
func (file *FileInfo) FindImportSpecByIdent(packageIdent string) *ast.ImportSpec {
	for _, imp := range file.Imports {
		if imp.Name != nil && imp.Name.Name == packageIdent {
			// import foo "foobar"
			return imp
		} else if strings.HasSuffix(imp.Path.Value, fmt.Sprintf(`/%s"`, packageIdent)) {
			// import "favclip/foo"
			return imp
		} else if imp.Path.Value == fmt.Sprintf(`"%s"`, packageIdent) {
			// import "foo"
			return imp
		}
	}
	return nil
}
189853
func getImports(
	interfaces []reflect.Type,
	pkgPath string) importMap {
	imports := make(importMap)
	for _, it := range interfaces {
		addImportForType(imports, it)
		addImportsForInterfaceMethods(imports, it)
	}

	// Make sure there are imports for other types used by the generated code
	// itself.
	imports["fmt"] = "fmt"
	imports["oglemock"] = "github.com/jacobsa/oglemock"
	imports["runtime"] = "runtime"
	imports["unsafe"] = "unsafe"

	// Remove any self-imports generated above.
	for k, v := range imports {
		if v == pkgPath {
			delete(imports, k)
		}
	}

	return imports
}
44506
func getImportDir(packageName string) string {
	packagePath, found := globalImportMap[packageName]
	if !found {
		return ""
	}

	// ./<packagePath> is needed to resolve references to plugin's own package
	searchList := []string{
		"./" + packageName,
		"./" + packagePath,
		"./vendor/" + packagePath,
		os.Getenv("GOPATH") + "/src/" + packagePath,
	}

	for _, testPath := range searchList {
		fp, err := os.Open(testPath)
		if err != nil {
			continue
		}
		stat, err := fp.Stat()
		if err != nil {
			continue
		}
		if !stat.IsDir() {
			continue
		}

		return testPath
	}

	return ""
}
866807
func ImportPaths(srcdir, cwd string, args []string) []string {
	args = importPathsNoDotExpansion(srcdir, cwd, args)
	var out []string
	for _, a := range args {
		if strings.Contains(a, "...") {
			pkgs, err := matchPackages(srcdir, a)
			if err != nil {
				fmt.Printf("could not load all packages: %v\n", err)
			}
			out = append(out, pkgs...)
			continue
		}
		out = append(out, a)
	}
	return out
}
115311
func (cmd *ImportCommand) importPath(ctx context.Context, fieldType string, useColumnKeys, useRowKeys bool, path string) error {
	// If fieldType is `int`, treat the import data as values to be range-encoded.
	if fieldType == pilosa.FieldTypeInt {
		return cmd.bufferValues(ctx, useColumnKeys, path)
	}
	return cmd.bufferBits(ctx, useColumnKeys, useRowKeys, path)
}
478141
func (f *file) lintImports() {
	for i, is := range f.f.Imports {
		_ = i
		if is.Name != nil && is.Name.Name == "." && !f.isTest() {
			f.errorf(is, 1, link(styleGuideBase+"#import-dot"), category("imports"), "should not use dot imports")
		}

	}
}