mirror of
https://github.com/golang/go.git
synced 2025-05-05 15:43:04 +00:00
text that you indent inside a comment, godoc will render as a pre-formatted block
parent
f5ada43e72
commit
5b344398b7
17
Comments.md
17
Comments.md
@ -20,4 +20,19 @@ Nearly every top-level type, const, var and func should have a comment. A commen
|
||||
func enterOrbit() os.Error {
|
||||
...
|
||||
}
|
||||
```
|
||||
```
|
||||
|
||||
All text that you indent inside a comment, godoc will render as a pre-formatted block. This facilitates code samples.
|
||||
|
||||
```go
|
||||
// fight can be used on any enemy and returns whether Superman won.
|
||||
//
|
||||
// Examples:
|
||||
//
|
||||
// fight("a random potato")
|
||||
// fight(LexLuthor{})
|
||||
//
|
||||
func fight(enemy interface{}) bool {
|
||||
...
|
||||
}
|
||||
```
|
||||
|
Loading…
x
Reference in New Issue
Block a user