Skip to content

Commit 9af8f4e

Browse files
dolmendnephin
authored andcommitted
fs: add go doc links
1 parent a80f057 commit 9af8f4e

File tree

4 files changed

+26
-26
lines changed

4 files changed

+26
-26
lines changed

fs/manifest.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ type dirEntry interface {
5555
Type() string
5656
}
5757

58-
// ManifestFromDir creates a Manifest by reading the directory at path. The
58+
// ManifestFromDir creates a [Manifest] by reading the directory at path. The
5959
// manifest stores the structure and properties of files in the directory.
60-
// ManifestFromDir can be used with Equal to compare two directories.
60+
// ManifestFromDir can be used with [Equal] to compare two directories.
6161
func ManifestFromDir(t assert.TestingT, path string) Manifest {
6262
if ht, ok := t.(helperT); ok {
6363
ht.Helper()

fs/ops.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ import (
1414

1515
const defaultFileMode = 0644
1616

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
2020
// the manifest to expect a value.
2121
type PathOp func(path Path) error
2222

@@ -38,7 +38,7 @@ type manifestDirectory interface {
3838
AddDirectory(path string, ops ...PathOp) error
3939
}
4040

41-
// WithContent writes content to a file at Path
41+
// WithContent writes content to a file at [Path]
4242
func WithContent(content string) PathOp {
4343
return func(path Path) error {
4444
if m, ok := path.(manifestFile); ok {
@@ -49,7 +49,7 @@ func WithContent(content string) PathOp {
4949
}
5050
}
5151

52-
// WithBytes write bytes to a file at Path
52+
// WithBytes write bytes to a file at [Path]
5353
func WithBytes(raw []byte) PathOp {
5454
return func(path Path) error {
5555
if m, ok := path.(manifestFile); ok {
@@ -60,7 +60,7 @@ func WithBytes(raw []byte) PathOp {
6060
}
6161
}
6262

63-
// WithReaderContent copies the reader contents to the file at Path
63+
// WithReaderContent copies the reader contents to the file at [Path]
6464
func WithReaderContent(r io.Reader) PathOp {
6565
return func(path Path) error {
6666
if m, ok := path.(manifestFile); ok {
@@ -77,7 +77,7 @@ func WithReaderContent(r io.Reader) PathOp {
7777
}
7878
}
7979

80-
// AsUser changes ownership of the file system object at Path
80+
// AsUser changes ownership of the file system object at [Path]
8181
func AsUser(uid, gid int) PathOp {
8282
return func(path Path) error {
8383
if m, ok := path.(manifestResource); ok {
@@ -132,7 +132,7 @@ func WithFiles(files map[string]string) PathOp {
132132
}
133133
}
134134

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]
136136
func FromDir(source string) PathOp {
137137
return func(path Path) error {
138138
if _, ok := path.(manifestDirectory); ok {
@@ -142,7 +142,7 @@ func FromDir(source string) PathOp {
142142
}
143143
}
144144

145-
// WithDir creates a subdirectory in the directory at path. Additional PathOp
145+
// WithDir creates a subdirectory in the directory at path. Additional [PathOp]
146146
// can be used to modify the subdirectory
147147
func WithDir(name string, ops ...PathOp) PathOp {
148148
const defaultMode = 0755
@@ -161,7 +161,7 @@ func WithDir(name string, ops ...PathOp) PathOp {
161161
}
162162
}
163163

164-
// Apply the PathOps to the File
164+
// Apply the PathOps to the [File]
165165
func Apply(t assert.TestingT, path Path, ops ...PathOp) {
166166
if ht, ok := t.(helperT); ok {
167167
ht.Helper()
@@ -178,7 +178,7 @@ func applyPathOps(path Path, ops []PathOp) error {
178178
return nil
179179
}
180180

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]
182182
func WithMode(mode os.FileMode) PathOp {
183183
return func(path Path) error {
184184
if m, ok := path.(manifestResource); ok {
@@ -241,7 +241,7 @@ func copyFile(source, dest string) error {
241241
// WithSymlink creates a symlink in the directory which links to target.
242242
// Target must be a path relative to the directory.
243243
//
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
245245
// the other functions in this package.
246246
func WithSymlink(path, target string) PathOp {
247247
return func(root Path) error {
@@ -255,7 +255,7 @@ func WithSymlink(path, target string) PathOp {
255255
// WithHardlink creates a link in the directory which links to target.
256256
// Target must be a path relative to the directory.
257257
//
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
259259
// the other functions in this package.
260260
func WithHardlink(path, target string) PathOp {
261261
return func(root Path) error {

fs/path.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ func (p *directoryPath) AddDirectory(path string, ops ...PathOp) error {
7777
return applyPathOps(exp, ops)
7878
}
7979

80-
// Expected returns a Manifest with a directory structured created by ops. The
81-
// PathOp operations are applied to the manifest as expectations of the
80+
// Expected returns a [Manifest] with a directory structured created by ops. The
81+
// [PathOp] operations are applied to the manifest as expectations of the
8282
// filesystem structure and properties.
8383
func Expected(t assert.TestingT, ops ...PathOp) Manifest {
8484
if ht, ok := t.(helperT); ok {
@@ -125,7 +125,7 @@ func normalizeID(id int) uint32 {
125125

126126
var anyFileContent = io.NopCloser(bytes.NewReader(nil))
127127

128-
// MatchAnyFileContent is a PathOp that updates a Manifest so that the file
128+
// MatchAnyFileContent is a [PathOp] that updates a [Manifest] so that the file
129129
// at path may contain any content.
130130
func MatchAnyFileContent(path Path) error {
131131
if m, ok := path.(*filePath); ok {
@@ -134,7 +134,7 @@ func MatchAnyFileContent(path Path) error {
134134
return nil
135135
}
136136

137-
// MatchContentIgnoreCarriageReturn is a PathOp that ignores cariage return
137+
// MatchContentIgnoreCarriageReturn is a [PathOp] that ignores cariage return
138138
// discrepancies.
139139
func MatchContentIgnoreCarriageReturn(path Path) error {
140140
if m, ok := path.(*filePath); ok {
@@ -145,7 +145,7 @@ func MatchContentIgnoreCarriageReturn(path Path) error {
145145

146146
const anyFile = "*"
147147

148-
// MatchExtraFiles is a PathOp that updates a Manifest to allow a directory
148+
// MatchExtraFiles is a [PathOp] that updates a [Manifest] to allow a directory
149149
// to contain unspecified files.
150150
func MatchExtraFiles(path Path) error {
151151
if m, ok := path.(*directoryPath); ok {
@@ -156,14 +156,14 @@ func MatchExtraFiles(path Path) error {
156156

157157
// CompareResult is the result of comparison.
158158
//
159-
// See gotest.tools/assert/cmp.StringResult for a convenient implementation of
159+
// See [gotest.tools/v3/assert/cmp.StringResult] for a convenient implementation of
160160
// this interface.
161161
type CompareResult interface {
162162
Success() bool
163163
FailureMessage() string
164164
}
165165

166-
// MatchFileContent is a PathOp that updates a Manifest to use the provided
166+
// MatchFileContent is a [PathOp] that updates a [Manifest] to use the provided
167167
// function to determine if a file's content matches the expectation.
168168
func MatchFileContent(f func([]byte) CompareResult) PathOp {
169169
return func(path Path) error {
@@ -174,7 +174,7 @@ func MatchFileContent(f func([]byte) CompareResult) PathOp {
174174
}
175175
}
176176

177-
// MatchFilesWithGlob is a PathOp that updates a Manifest to match files using
177+
// MatchFilesWithGlob is a [PathOp] that updates a [Manifest] to match files using
178178
// glob pattern, and check them using the ops.
179179
func MatchFilesWithGlob(glob string, ops ...PathOp) PathOp {
180180
return func(path Path) error {
@@ -188,7 +188,7 @@ func MatchFilesWithGlob(glob string, ops ...PathOp) PathOp {
188188
// anyFileMode is represented by uint32_max
189189
const anyFileMode os.FileMode = 4294967295
190190

191-
// MatchAnyFileMode is a PathOp that updates a Manifest so that the resource at path
191+
// MatchAnyFileMode is a [PathOp] that updates a [Manifest] so that the resource at path
192192
// will match any file mode.
193193
func MatchAnyFileMode(path Path) error {
194194
if m, ok := path.(manifestResource); ok {

fs/report.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ import (
1717
// Equal compares a directory to the expected structured described by a manifest
1818
// and returns success if they match. If they do not match the failure message
1919
// will contain all the differences between the directory structure and the
20-
// expected structure defined by the Manifest.
20+
// expected structure defined by the [Manifest].
2121
//
22-
// Equal is a cmp.Comparison which can be used with assert.Assert().
22+
// Equal is a [cmp.Comparison] which can be used with [gotest.tools/v3/assert.Assert].
2323
func Equal(path string, expected Manifest) cmp.Comparison {
2424
return func() cmp.Result {
2525
actual, err := manifestFromDir(path)

0 commit comments

Comments
 (0)