Skip to content

Commit 638f16c

Browse files
committed
docs: uses new go1.19 doc features
Signed-off-by: Maxime Soulé <btik-git@scoubidou.com>
1 parent c43cb51 commit 638f16c

File tree

3 files changed

+269
-211
lines changed

3 files changed

+269
-211
lines changed

file.go

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,18 @@ import (
1313
// file := httpmock.File("file.txt")
1414
// fmt.Printf("file: %s\n", file)
1515
//
16-
// prints the content of file "file.txt" as String() method is used.
16+
// prints the content of file "file.txt" as [File.String] method is used.
1717
//
1818
// To print the file name, and not its content, simply do:
1919
//
2020
// file := httpmock.File("file.txt")
2121
// fmt.Printf("file: %s\n", string(file))
2222
type File string
2323

24-
// MarshalJSON implements json.Marshaler.
24+
// MarshalJSON implements [encoding/json.Marshaler].
2525
//
26-
// Useful to be used in conjunction with NewJsonResponse() or
27-
// NewJsonResponder() as in:
26+
// Useful to be used in conjunction with [NewJsonResponse] or
27+
// [NewJsonResponder] as in:
2828
//
2929
// httpmock.NewJsonResponder(200, httpmock.File("body.json"))
3030
func (f File) MarshalJSON() ([]byte, error) {
@@ -38,8 +38,8 @@ func (f File) bytes() ([]byte, error) {
3838
// Bytes returns the content of file as a []byte. If an error occurs
3939
// during the opening or reading of the file, it panics.
4040
//
41-
// Useful to be used in conjunction with NewBytesResponse() or
42-
// NewBytesResponder() as in:
41+
// Useful to be used in conjunction with [NewBytesResponse] or
42+
// [NewBytesResponder] as in:
4343
//
4444
// httpmock.NewBytesResponder(200, httpmock.File("body.raw").Bytes())
4545
func (f File) Bytes() []byte {
@@ -50,11 +50,12 @@ func (f File) Bytes() []byte {
5050
return b
5151
}
5252

53-
// String returns the content of file as a string. If an error occurs
54-
// during the opening or reading of the file, it panics.
53+
// String implements [fmt.Stringer] and returns the content of file as
54+
// a string. If an error occurs during the opening or reading of the
55+
// file, it panics.
5556
//
56-
// Useful to be used in conjunction with NewStringResponse() or
57-
// NewStringResponder() as in:
57+
// Useful to be used in conjunction with [NewStringResponse] or
58+
// [NewStringResponder] as in:
5859
//
5960
// httpmock.NewStringResponder(200, httpmock.File("body.txt").String())
6061
func (f File) String() string {

0 commit comments

Comments
 (0)