func collectExamples(p *doc.Package) *examples {
	exs := &examples{
		List: nil,
		Map:  make(map[string][]*example),
	}
	WalkExamples(p, func(id string, ex *doc.Example) {
		suffix := strings.Title(ex.Suffix)
		ex0 := &example{
			Example:  ex,
			ID:       exampleID(id, suffix),
			ParentID: id,
			Suffix:   suffix,
		}
		exs.List = append(exs.List, ex0)
		exs.Map[id] = append(exs.Map[id], ex0)
	})
	sort.SliceStable(exs.List, func(i, j int) bool {
		// TODO: Break ties by sorting by suffix, unless
		// not needed because of upstream slice order.
		return exs.List[i].ParentID < exs.List[j].ParentID
	})
	return exs
}
// collectExamples extracts examples from p
// into the internal examples representation.
collectExamples extracts examples from p
into the internal examples representation.
// collectExamples extracts examples from p // into the internal examples representation .
func collectExamples(p *doc.Package) *examples {
	exs := &examples{
		List: nil,
		Map:  make(map[string][]*example),
	}
	WalkExamples(p, func(id string, ex *doc.Example) {
		suffix := strings.Title(ex.Suffix)
		ex0 := &example{
			Example:  ex,
			ID:       exampleID(id, suffix),
			ParentID: id,
			Suffix:   suffix,
		}
		exs.List = append(exs.List, ex0)
		exs.Map[id] = append(exs.Map[id], ex0)
	})
	sort.SliceStable(exs.List, func(i, j int) bool {
		return exs.List[i].ParentID < exs.List[j].ParentID
	})
	return exs
}
func collectExamples ( p * doc . Package ) * examples { exs := & examples { List : nil , Map : make ( map [ string ] [ ] * example ) , } WalkExamples ( p , func ( id string , ex * doc . Example ) { suffix := strings . Title ( ex . Suffix ) ex0 := & example { Example : ex , ID : exampleID ( id , suffix ) , ParentID : id , Suffix : suffix , } exs . List = append ( exs . List , ex0 ) exs . Map [ id ] = append ( exs . Map [ id ] , ex0 ) } ) sort . SliceStable ( exs . List , func ( i , j int ) bool { return exs . List [ i ] . ParentID < exs . List [ j ] . ParentID } ) return exs }
collectExamples extracts examples from p
into the internal examples representation.
collectExamples extracts examples from p into the internal examples representation .
// TODO: Break ties by sorting by suffix, unless // not needed because of upstream slice order.