envy.go
func CurrentModule() (string, error) {
	if !Mods() {
		return CurrentPackage(), nil
	}
	moddata, err := ioutil.ReadFile("go.mod")
	if err != nil {
		return "", errors.New("go.mod cannot be read or does not exist while go module is enabled")
	}
	packagePath := modfile.ModulePath(moddata)
	if packagePath == "" {
		return "", errors.New("go.mod is malformed")
	}
	return packagePath, nil
}
func CurrentModule() (string, error) {
	if !Mods() {
		return CurrentPackage(), nil
	}
	moddata, err := ioutil.ReadFile("go.mod")
	if err != nil {
		return "", errors.New("go.mod cannot be read or does not exist while go module is enabled")
	}
	packagePath := modfile.ModulePath(moddata)
	if packagePath == "" {
		return "", errors.New("go.mod is malformed")
	}
	return packagePath, nil
}
func CurrentModule ( ) ( string , error ) { if ! Mods ( ) { return CurrentPackage ( ) , nil } moddata , err := ioutil . ReadFile ( " " ) if err != nil { return " " , errors . New ( " " ) } packagePath := modfile . ModulePath ( moddata ) if packagePath == " " { return " " , errors . New ( " " ) } return packagePath , nil }
// CurrentModule will attempt to return the module name from `go.mod` if
// modules are enabled.
// If modules are not enabled it will fallback to using CurrentPackage instead.
CurrentModule will attempt to return the module name from go . mod if modules are enabled . If modules are not enabled it will fallback to using CurrentPackage instead .