// empty if no go.mod, GO111MODULE=off or go without go modules support
436590
func goModPath(fname string, isDir bool) (string, error) {
	root := fname
	if !isDir {
		root = filepath.Dir(fname)
	}

	goModPathCache.RLock()
	goModPath, ok := goModPathCache.paths[root]
	goModPathCache.RUnlock()
	if ok {
		return goModPath, nil
	}

	defer func() {
		goModPathCache.Lock()
		goModPathCache.paths[root] = goModPath
		goModPathCache.Unlock()
	}()

	cmd := exec.Command("go", "env", "GOMOD")
	cmd.Dir = root

	stdout, err := cmd.Output()
	if err != nil {
		return "", err
	}

	goModPath = string(bytes.TrimSpace(stdout))

	return goModPath, nil
}
1091109
func (s Session) Empty() bool {
	i := 0
	for k := range s {
		i++
		if k == SessionObjectKeyName || k == SessionMapKeyName {
			continue
		}
	}
	return i == 0
}
1194383
func Main(module Module, commandModules ...Module) {
	app := NewApp(module, commandModules...)
	errutil.Trace(app.Run(os.Args))
}
510578
func ParseGoMod(dir string) (result []Module, err error) {
	cmd := exec.Command("go", "list", "-m", "-json", "all")
	cmd.Dir = dir
	goModData, err := cmd.Output()
	if err != nil {
		return
	}

	modsData := reJSONObj.FindAll(goModData, -1)

	result = make([]Module, len(modsData))
	for i, d := range modsData {
		mod := Module{}
		if err = json.Unmarshal(d, &mod); err != nil {
			return []Module{}, err
		}
		result[i] = mod
	}

	return
}
644075
func isEmpty(a *Automaton) bool {
	if a.numStates() == 0 {
		// common case: no states
		return true
	}
	if !a.IsAccept(0) && a.numTransitions(0) == 0 {
		// common case: just one initial state
		return true
	}
	if a.IsAccept(0) {
		// apparently common case: it accepts the empty string
		return false
	}

	workList := list.New()
	seen := util.NewOpenBitSet()
	workList.PushBack(0)
	seen.Set(0)

	t := newTransition()
	for workList.Len() > 0 {
		state := workList.Remove(workList.Front()).(int)
		if a.IsAccept(state) {
			return false
		}
		count := a.initTransition(state, t)
		for i := 0; i < count; i++ {
			a.nextTransition(t)
			if !seen.Get(int64(t.dest)) {
				workList.PushBack(t.dest)
				seen.Set(int64(t.dest))
			}
		}
	}

	return true
}
514004
func shutdownModules() {
	for i := len(modulesArr) - 1; i >= 0; i-- {
		modulesArr[i].module.BeforeShutdown()
	}

	for i := len(modulesArr) - 1; i >= 0; i-- {
		name := modulesArr[i].name
		mod := modulesArr[i].module

		logger.Log.Debugf("stopping module: %s", name)
		if err := mod.Shutdown(); err != nil {
			logger.Log.Warnf("error stopping module: %s", name)
		}
		logger.Log.Infof("module: %s stopped!", name)
	}
}
226508
func (t Term) Mod(args ...interface{}) Term {
	return constructMethodTerm(t, "Mod", p.Term_MOD, args, map[string]interface{}{})
}
1031081
func Empty(n int) *Virtual {
	switch {
	case n < 0:
		return nil
	case n == 0:
		return null
	case n == 1:
		return singleton()
	}
	return &Virtual{
		order:  n,
		edge:   neverEdge,
		cost:   zero,
		degree: degreeZero,
		visit:  noNeighbors,
	}
}
69429
func (d *InstanceDiff) Empty() bool {
	if d == nil {
		return true
	}

	d.mu.Lock()
	defer d.mu.Unlock()
	return !d.Destroy &&
		!d.DestroyTainted &&
		!d.DestroyDeposed &&
		len(d.Attributes) == 0
}
419857
func MustParseModule(input string) *Module {
	parsed, err := ParseModule("", input)
	if err != nil {
		panic(err)
	}
	return parsed
}
845118
func (s *State) Module(addr addrs.ModuleInstance) *Module {
	if s == nil {
		panic("State.Module on nil *State")
	}
	return s.Modules[addr.String()]
}
343939
func (ls *LState) PreloadModule(name string, loader LGFunction) {
	preload := ls.GetField(ls.GetField(ls.Get(EnvironIndex), "package"), "preload")
	if _, ok := preload.(*LTable); !ok {
		ls.RaiseError("package.preload must be a table")
	}
	ls.SetField(preload, name, ls.NewFunction(loader))
}
411318
func Empty(t TestingT, object interface{}, msgAndArgs ...interface{}) bool {
	if h, ok := t.(tHelper); ok {
		h.Helper()
	}

	pass := isEmpty(object)
	if !pass {
		Fail(t, fmt.Sprintf("Should be empty, but was %v", object), msgAndArgs...)
	}

	return pass

}
1195554
func (p *Repository) Empty() bool {
	p.Mutex.Lock()
	defer p.Mutex.Unlock()
	return p.NumRules() == 0
}
919542
func GetModulePath(ctx context.Context) string {
	module := ctx.Value(moduleKey{})
	if module == nil {
		return ""
	}

	return module.(string)
}
473911
func getModuleRoutes(moduleName, joinedPath string, validate bool) (routes []*Route, err *Error) {
	// Look up the module.  It may be not found due to the common case of e.g. the
	// testrunner module being active only in dev mode.
	module, found := ModuleByName(moduleName)
	if !found {
		routerLog.Debug("getModuleRoutes: Skipping routes for inactive module", "module", moduleName)
		return nil, nil
	}
	routePath := filepath.Join(module.Path, "conf", "routes")
	if _, e := os.Stat(routePath); e == nil {
		routes, err = parseRoutesFile(module, routePath, joinedPath, validate)
	}
	if err == nil {
		for _, route := range routes {
			route.ModuleSource = module
		}
	}

	return routes, err
}
1166614
func Empty(any *any.Any) (proto.Message, error) {
	aname, err := AnyMessageName(any)
	if err != nil {
		return nil, err
	}

	t := proto.MessageType(aname)
	if t == nil {
		return nil, fmt.Errorf("any: message type %q isn't linked in", aname)
	}
	return reflect.New(t.Elem()).Interface().(proto.Message), nil
}