selinux/selinux.go
func Chcon(fpath string, scon string, recurse bool) error {
	if scon == "" {
		return nil
	}
	if err := badPrefix(fpath); err != nil {
		return err
	}
	callback := func(p string, info os.FileInfo, err error) error {
		return Setfilecon(p, scon)
	}

	if recurse {
		return filepath.Walk(fpath, callback)
	}

	return Setfilecon(fpath, scon)
}
func Chcon(fpath string, scon string, recurse bool) error {
	if scon == "" {
		return nil
	}
	if err := badPrefix(fpath); err != nil {
		return err
	}
	callback := func(p string, info os.FileInfo, err error) error {
		return Setfilecon(p, scon)
	}

	if recurse {
		return filepath.Walk(fpath, callback)
	}

	return Setfilecon(fpath, scon)
}
func Chcon ( fpath string , scon string , recurse bool ) error { if scon == " " { return nil } if err := badPrefix ( fpath ) ; err != nil { return err } callback := func ( p string , info os . FileInfo , err error ) error { return Setfilecon ( p , scon ) } if recurse { return filepath . Walk ( fpath , callback ) } return Setfilecon ( fpath , scon ) }
// Change the fpath file object to the SELinux label scon.
// If the fpath is a directory and recurse is true Chcon will walk the
// directory tree setting the label
Change the fpath file object to the SELinux label scon . If the fpath is a directory and recurse is true Chcon will walk the directory tree setting the label