Skip to content

Commit 8c5f336

Browse files
authored
Merge pull request #151 from kolyshkin/cap-docs
capability: doc improvements
2 parents 7d73c88 + cf0f98c commit 8c5f336

3 files changed

Lines changed: 21 additions & 16 deletions

File tree

capability/CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ from https://github.com/syndtr/gocapability/commit/42c35b4376354fd5.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8-
## 0.2.0 - 2024-09-16
8+
## [0.2.0] - 2024-09-16
99

1010
This is the first release after the move to a new home in
1111
github.com/moby/sys/capability.
@@ -55,6 +55,7 @@ This is an initial release since the fork.
5555
[LastCap]: https://pkg.go.dev/github.com/moby/sys/capability#LastCap
5656

5757
<!-- Minor releases. -->
58+
[0.2.0]: https://github.com/moby/sys/releases/tag/capability%2Fv0.2.0
5859
[0.1.1]: https://github.com/kolyshkin/capability/compare/v0.1.0...v0.1.1
5960
[0.1.0]: https://github.com/kolyshkin/capability/compare/42c35b4376354fd5...v0.1.0
6061

capability/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ This is a fork of (apparently no longer maintained)
22
https://github.com/syndtr/gocapability package. It provides basic primitives to
33
work with [Linux capabilities][capabilities(7)].
44

5+
For changes, see [CHANGELOG.md](./CHANGELOG.md).
6+
57
[![Go Reference](https://pkg.go.dev/badge/github.com/moby/sys/capability/capability.svg)](https://pkg.go.dev/github.com/moby/sys/capability)
68

79
## Alternatives

capability/capability.go

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -61,25 +61,26 @@ type Capabilities interface {
6161
Apply(kind CapType) error
6262
}
6363

64-
// NewPid initializes a new Capabilities object for given pid when
64+
// NewPid initializes a new [Capabilities] object for given pid when
6565
// it is nonzero, or for the current process if pid is 0.
6666
//
67-
// Deprecated: Replace with NewPid2. For example, replace:
67+
// Deprecated: Replace with [NewPid2] followed by [Capabilities.Load].
68+
// For example, replace:
6869
//
6970
// c, err := NewPid(0)
7071
// if err != nil {
71-
// return err
72+
// return err
7273
// }
7374
//
7475
// with:
7576
//
7677
// c, err := NewPid2(0)
7778
// if err != nil {
78-
// return err
79+
// return err
7980
// }
8081
// err = c.Load()
8182
// if err != nil {
82-
// return err
83+
// return err
8384
// }
8485
func NewPid(pid int) (Capabilities, error) {
8586
c, err := newPid(pid)
@@ -90,32 +91,33 @@ func NewPid(pid int) (Capabilities, error) {
9091
return c, err
9192
}
9293

93-
// NewPid2 initializes a new Capabilities object for given pid when
94-
// it is nonzero, or for the current process if pid is 0. This
94+
// NewPid2 initializes a new [Capabilities] object for given pid when
95+
// it is nonzero, or for the current process if pid is 0. This
9596
// does not load the process's current capabilities; to do that you
96-
// must call Load explicitly.
97+
// must call [Capabilities.Load] explicitly.
9798
func NewPid2(pid int) (Capabilities, error) {
9899
return newPid(pid)
99100
}
100101

101102
// NewFile initializes a new Capabilities object for given file path.
102103
//
103-
// Deprecated: Replace with NewFile2. For example, replace:
104+
// Deprecated: Replace with [NewFile2] followed by [Capabilities.Load].
105+
// For example, replace:
104106
//
105107
// c, err := NewFile(path)
106108
// if err != nil {
107-
// return err
109+
// return err
108110
// }
109111
//
110112
// with:
111113
//
112114
// c, err := NewFile2(path)
113115
// if err != nil {
114-
// return err
116+
// return err
115117
// }
116118
// err = c.Load()
117119
// if err != nil {
118-
// return err
120+
// return err
119121
// }
120122
func NewFile(path string) (Capabilities, error) {
121123
c, err := newFile(path)
@@ -126,9 +128,9 @@ func NewFile(path string) (Capabilities, error) {
126128
return c, err
127129
}
128130

129-
// NewFile2 creates a new initialized Capabilities object for given
130-
// file path. This does not load the process's current capabilities;
131-
// to do that you must call Load explicitly.
131+
// NewFile2 creates a new initialized [Capabilities] object for given
132+
// file path. This does not load the process's current capabilities;
133+
// to do that you must call [Capabilities.Load] explicitly.
132134
func NewFile2(path string) (Capabilities, error) {
133135
return newFile(path)
134136
}

0 commit comments

Comments
 (0)