Commit 8f10c764 authored by Olivier Duperray's avatar Olivier Duperray Committed by Andrew Gerrand

cmd/godoc: document package-level examples

Fixes  issue  5807 .

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/23940043
parent 597b9c0d
...@@ -73,17 +73,19 @@ ...@@ -73,17 +73,19 @@
// //
// Example functions without output comments are compiled but not executed. // Example functions without output comments are compiled but not executed.
// //
// The naming convention to declare examples for a function F, a type T and // The naming convention to declare examples for the package, a function F, a type T and
// method M on type T are: // method M on type T are:
// //
// func Example() { ... }
// func ExampleF() { ... } // func ExampleF() { ... }
// func ExampleT() { ... } // func ExampleT() { ... }
// func ExampleT_M() { ... } // func ExampleT_M() { ... }
// //
// Multiple example functions for a type/function/method may be provided by // Multiple example functions for a package/type/function/method may be provided by
// appending a distinct suffix to the name. The suffix must start with a // appending a distinct suffix to the name. The suffix must start with a
// lower-case letter. // lower-case letter.
// //
// func Example_suffix() { ... }
// func ExampleF_suffix() { ... } // func ExampleF_suffix() { ... }
// func ExampleT_suffix() { ... } // func ExampleT_suffix() { ... }
// func ExampleT_M_suffix() { ... } // func ExampleT_M_suffix() { ... }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment