@@ -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// }
8485func 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.
9798func 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// }
120122func 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.
132134func NewFile2 (path string ) (Capabilities , error ) {
133135 return newFile (path )
134136}
0 commit comments