https://github.com/mmcloughlin/cite
Cite snippets in your godoc
https://github.com/mmcloughlin/cite
Last synced: 6 months ago
JSON representation
Cite snippets in your godoc
- Host: GitHub
- URL: https://github.com/mmcloughlin/cite
- Owner: mmcloughlin
- License: mit
- Created: 2016-12-05T00:42:23.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2023-02-26T22:25:49.000Z (over 2 years ago)
- Last Synced: 2025-04-05T14:47:28.289Z (7 months ago)
- Language: Go
- Homepage: https://godoc.org/github.com/mmcloughlin/cite
- Size: 47.9 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# cite
Cite snippets in your godoc[](https://pkg.go.dev/github.com/mmcloughlin/cite)
[](https://travis-ci.org/mmcloughlin/cite)
[](https://coveralls.io/r/mmcloughlin/cite)
[](https://goreportcard.com/report/github.com/mmcloughlin/cite)## Install
```
go install github.com/mmcloughlin/cite/cmd/cite
```## Usage
To reference something, add an insert line into your `godoc`.
```go
package exampleimport "fmt"
// Greet says hello to who.
//
// Insert: https://github.com/mmcloughlin/cite/blob/master/example/grinch.txt#L6-L8
func Greet(who string) {
fmt.Printf("Hello, %s!\n", who)
}```
Then run
```
$ cite process example.go
```It will fetch the reference and insert it into your code.
```go
package exampleimport "fmt"
// Greet says hello to who.
//
// Reference: https://github.com/mmcloughlin/cite/blob/master/example/grinch.txt#L6-L8
//
// Every Who Down in Whoville Liked Christmas a lot...
// But the Grinch,Who lived just north of Whoville, Did NOT!
// The Grinch hated Christmas! The whole Christmas season!
//
func Greet(who string) {
fmt.Printf("Hello, %s!\n", who)
}```
It should [look nice in your godoc](https://godoc.org/github.com/mmcloughlin/cite/example).