Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix displaying testable example on pkg.go.dev #587

Merged
merged 1 commit into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions decode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1999,7 +1999,7 @@ w: w_value
}
}

func Example_YAMLTags() {
func ExampleUnmarshal_yAMLTags() {
yml := `---
foo: 1
bar: c
Expand Down Expand Up @@ -2179,7 +2179,7 @@ map: &map
})
}

func Example_JSONTags() {
func ExampleUnmarshal_jSONTags() {
yml := `---
foo: 1
bar: c
Expand All @@ -2198,7 +2198,7 @@ bar: c
// c
}

func Example_DisallowUnknownField() {
func ExampleDecoder_Decode_disallowUnknownField() {
var v struct {
A string `yaml:"simple"`
C string `yaml:"complicated"`
Expand All @@ -2219,7 +2219,7 @@ unknown: string
// ^
}

func Example_Unmarshal_Node() {
func ExampleNodeToValue() {
f, err := parser.ParseBytes([]byte("text: node example"), 0)
if err != nil {
panic(err)
Expand Down
8 changes: 4 additions & 4 deletions encode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1289,7 +1289,7 @@ func TestEncoder_MultipleDocuments(t *testing.T) {
}
}

func Example_Marshal_Node() {
func ExampleMarshal_node() {
type T struct {
Text ast.Node `yaml:"text"`
}
Expand All @@ -1306,7 +1306,7 @@ func Example_Marshal_Node() {
// text: node example
}

func Example_Marshal_ExplicitAnchorAlias() {
func ExampleMarshal_explicitAnchorAlias() {
type T struct {
A int
B string
Expand All @@ -1329,7 +1329,7 @@ func Example_Marshal_ExplicitAnchorAlias() {
// d: *x
}

func Example_Marshal_ImplicitAnchorAlias() {
func ExampleMarshal_implicitAnchorAlias() {
type T struct {
I int
S string
Expand Down Expand Up @@ -1454,7 +1454,7 @@ func (t TextMarshaler) MarshalText() ([]byte, error) {
return []byte(strconv.FormatInt(int64(t), 8)), nil
}

func Example_MarshalYAML() {
func ExampleMarshal() {
var slow SlowMarshaler
slow.A = "Hello slow poke"
slow.B = 100
Expand Down
4 changes: 2 additions & 2 deletions path_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ b: "hello"
// 3 | b: "hello"
}

func ExamplePath_AnnotateSourceWithComment() {
func ExamplePath_AnnotateSource_withComment() {
yml := `
# This is my document
doc:
Expand Down Expand Up @@ -664,7 +664,7 @@ doc:
// 9 | other: value3
}

func ExamplePath_PathString() {
func ExamplePathString() {
yml := `
store:
book:
Expand Down
Loading