diff options
author | Andrew G. Morgan <morgan@kernel.org> | 2021-09-17 21:07:19 -0700 |
---|---|---|
committer | Andrew G. Morgan <morgan@kernel.org> | 2021-09-17 21:07:19 -0700 |
commit | 33a6686e2bc126916145f01246ee6be80669dcdb (patch) | |
tree | 5c3f8cfd8f09bef2bfe8395dea0d832cad22c008 | |
parent | 01627eae86cc299de459067614e6964b63bb6bcb (diff) | |
download | libcap2-33a6686e2bc126916145f01246ee6be80669dcdb.tar.gz |
More compliant cap.Differs documentation.
Deprecation has a stylized comment format as per go.dev.
Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
-rw-r--r-- | cap/flags.go | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/cap/flags.go b/cap/flags.go index 88ad355..df7a9a5 100644 --- a/cap/flags.go +++ b/cap/flags.go @@ -208,9 +208,23 @@ func (c *Set) Cf(d *Set) (Diff, error) { // Differs processes the result of Compare and determines if the // Flag's components were different. // -// Use of this function is deprecated in favor of the (Diff).Has() -// function, where Diff is returned as a result of the (*Set).Cf() -// function. +// Deprecated: Replace with (Diff).Has(). +// +// Example, replace this: +// +// diff, err := a.Compare(b) +// ... +// if diff & (1 << Effective) { +// ... different effective capabilities ... +// } +// +// with this: +// +// diff, err := a.Cf(b) +// ... +// if diff.Has(Effective) { +// ... different effective capabilities ... +// } func Differs(cf uint, vec Flag) bool { return cf&(1<<vec) != 0 } |