@@ -14,9 +14,9 @@ import (
14
14
15
15
const defaultFileMode = 0644
16
16
17
- // PathOp is a function which accepts a Path and performs an operation on that
18
- // path. When called with real filesystem objects (File or Dir) a PathOp modifies
19
- // the filesystem at the path. When used with a Manifest object a PathOp updates
17
+ // PathOp is a function which accepts a [ Path] and performs an operation on that
18
+ // path. When called with real filesystem objects ([ File] or [ Dir] ) a PathOp modifies
19
+ // the filesystem at the path. When used with a [ Manifest] object a PathOp updates
20
20
// the manifest to expect a value.
21
21
type PathOp func (path Path ) error
22
22
@@ -38,7 +38,7 @@ type manifestDirectory interface {
38
38
AddDirectory (path string , ops ... PathOp ) error
39
39
}
40
40
41
- // WithContent writes content to a file at Path
41
+ // WithContent writes content to a file at [ Path]
42
42
func WithContent (content string ) PathOp {
43
43
return func (path Path ) error {
44
44
if m , ok := path .(manifestFile ); ok {
@@ -49,7 +49,7 @@ func WithContent(content string) PathOp {
49
49
}
50
50
}
51
51
52
- // WithBytes write bytes to a file at Path
52
+ // WithBytes write bytes to a file at [ Path]
53
53
func WithBytes (raw []byte ) PathOp {
54
54
return func (path Path ) error {
55
55
if m , ok := path .(manifestFile ); ok {
@@ -60,7 +60,7 @@ func WithBytes(raw []byte) PathOp {
60
60
}
61
61
}
62
62
63
- // WithReaderContent copies the reader contents to the file at Path
63
+ // WithReaderContent copies the reader contents to the file at [ Path]
64
64
func WithReaderContent (r io.Reader ) PathOp {
65
65
return func (path Path ) error {
66
66
if m , ok := path .(manifestFile ); ok {
@@ -77,7 +77,7 @@ func WithReaderContent(r io.Reader) PathOp {
77
77
}
78
78
}
79
79
80
- // AsUser changes ownership of the file system object at Path
80
+ // AsUser changes ownership of the file system object at [ Path]
81
81
func AsUser (uid , gid int ) PathOp {
82
82
return func (path Path ) error {
83
83
if m , ok := path .(manifestResource ); ok {
@@ -132,7 +132,7 @@ func WithFiles(files map[string]string) PathOp {
132
132
}
133
133
}
134
134
135
- // FromDir copies the directory tree from the source path into the new Dir
135
+ // FromDir copies the directory tree from the source path into the new [ Dir]
136
136
func FromDir (source string ) PathOp {
137
137
return func (path Path ) error {
138
138
if _ , ok := path .(manifestDirectory ); ok {
@@ -142,7 +142,7 @@ func FromDir(source string) PathOp {
142
142
}
143
143
}
144
144
145
- // WithDir creates a subdirectory in the directory at path. Additional PathOp
145
+ // WithDir creates a subdirectory in the directory at path. Additional [ PathOp]
146
146
// can be used to modify the subdirectory
147
147
func WithDir (name string , ops ... PathOp ) PathOp {
148
148
const defaultMode = 0755
@@ -161,7 +161,7 @@ func WithDir(name string, ops ...PathOp) PathOp {
161
161
}
162
162
}
163
163
164
- // Apply the PathOps to the File
164
+ // Apply the PathOps to the [ File]
165
165
func Apply (t assert.TestingT , path Path , ops ... PathOp ) {
166
166
if ht , ok := t .(helperT ); ok {
167
167
ht .Helper ()
@@ -178,7 +178,7 @@ func applyPathOps(path Path, ops []PathOp) error {
178
178
return nil
179
179
}
180
180
181
- // WithMode sets the file mode on the directory or file at path
181
+ // WithMode sets the file mode on the directory or file at [Path]
182
182
func WithMode (mode os.FileMode ) PathOp {
183
183
return func (path Path ) error {
184
184
if m , ok := path .(manifestResource ); ok {
@@ -241,7 +241,7 @@ func copyFile(source, dest string) error {
241
241
// WithSymlink creates a symlink in the directory which links to target.
242
242
// Target must be a path relative to the directory.
243
243
//
244
- // Note: the argument order is the inverse of os.Symlink to be consistent with
244
+ // Note: the argument order is the inverse of [ os.Symlink] to be consistent with
245
245
// the other functions in this package.
246
246
func WithSymlink (path , target string ) PathOp {
247
247
return func (root Path ) error {
@@ -255,7 +255,7 @@ func WithSymlink(path, target string) PathOp {
255
255
// WithHardlink creates a link in the directory which links to target.
256
256
// Target must be a path relative to the directory.
257
257
//
258
- // Note: the argument order is the inverse of os.Link to be consistent with
258
+ // Note: the argument order is the inverse of [ os.Link] to be consistent with
259
259
// the other functions in this package.
260
260
func WithHardlink (path , target string ) PathOp {
261
261
return func (root Path ) error {
0 commit comments