Merge pull request #1 from avelino/master

update
This commit is contained in:
Chris Lu 2015-10-24 09:41:21 -07:00
commit b51c3faa32
5 changed files with 592 additions and 124 deletions

11
.travis.yml Normal file
View File

@ -0,0 +1,11 @@
language: go
go:
- 1.4
sudo: false
install:
- go get github.com/russross/blackfriday
- go get github.com/PuerkitoBio/goquery

View File

@ -1,11 +1,13 @@
This resource was made by the Go community and wouldn't be possible without you! We appreciate and recognize [all contributors](https://github.com/avelino/awesome-go/graphs/contributors).
Join us on IRC at **#awesome-go** on freenode [web access](http://webchat.freenode.net/?channels=awesome-go)
# Contribution Guidelines
- **To add to the list:** Submit a pull request
- **To remove from the list:** Open an issue
- **To add, remove, or change things on the list:** Submit a pull request
To set this list apart from and compliment the excellent [Go wiki Projects page](https://code.google.com/p/go-wiki/wiki/Projects), awesome-go is a specially curated list for high-quality, actively maintained Go packages and resources.
To set this list apart from and compliment the excellent [Go wiki Projects page](https://golang.org/wiki/Projects), awesome-go is a specially curated list for high-quality, actively maintained Go packages and resources.
- List items should be sorted *alphabetically*.
- Each item should be limited to one link
@ -18,16 +20,22 @@ Please contribute links to packages/projects you have used or are familiar with.
## Quality standard
To stay on the list, package repositories should adhere to these quality standards:
To be on the list, project repositories should adhere to these quality standards:
- Generally useful to the community
- Functional
- Actively maintained (even if that just means acknowledging open issues when they arise)
- Stable, or progressing toward stable
- Documented (preferably godoc.org)
- Tests are preferred (when possible)
- Code functions as documented and expected
- Generally useful to the wider community of Go programmers
- Actively maintained
- Regular, recent commits
- Or, for finished projects, issues and pull requests are responded to
- Stable or progressing toward stable
- Thoroughly documented (README, godoc comments, etc.)
- Tests, where practical
## Reporting issues
Please open an issue if you find anything that could be improved or have suggestions for making the list a more valuable resource. We realize sometimes packages fall into abandonment or have breaking builds for extended periods of time, so if you see that, please let us know. We also realize that sometimes projects are just going through transitions or are more experimental in nature. These can still be cool, but we can indicate them as transitory or experimental -- again, just open an issue. Thanks everyone!
Please open an issue if you would like to discuss anything that could be improved or have suggestions for making the list a more valuable resource. We realize sometimes packages fall into abandonment or have breaking builds for extended periods of time, so if you see that, feel free to change its listing or let us know. We also realize that sometimes projects are just going through transitions or are more experimental in nature. These can still be cool, but we can indicate them as transitory or experimental.
Removal changes will not be applied until they have been pending for a minimum of 1 week (7 days). This grace window benefits projects that may be going through a temporary transition but are otherwise worthy of being on the list.
Thanks everyone!

583
README.md

File diff suppressed because it is too large Load Diff

1
repo.go Normal file
View File

@ -0,0 +1 @@
package repo

87
repo_test.go Normal file
View File

@ -0,0 +1,87 @@
package repo
import (
"bytes"
"io/ioutil"
"log"
"sort"
"strings"
"testing"
"github.com/PuerkitoBio/goquery"
"github.com/russross/blackfriday"
)
func TestAlpha(t *testing.T) {
query := startQuery()
query.Find("body > ul").Each(func(_ int, s *goquery.Selection) {
testList(t, s)
})
}
func TestDuplicatedLinks(t *testing.T) {
query := startQuery()
links := make(map[string]bool, 0)
query.Find("body a").Each(func(_ int, s *goquery.Selection) {
href, ok := s.Attr("href")
if !ok {
log.Printf("expected '%s' href", s)
t.Fail()
}
if links[href] {
log.Printf("duplicated link '%s'", href)
t.Fail()
return
}
links[href] = true
})
}
func testList(t *testing.T, list *goquery.Selection) {
list.Find("ul").Each(func(_ int, items *goquery.Selection) {
testList(t, items)
items.RemoveFiltered("ul")
})
checkAlphabeticOrder(t, list)
}
func readme() []byte {
input, err := ioutil.ReadFile("./README.md")
if err != nil {
panic(err)
}
html := append([]byte("<body>"), blackfriday.MarkdownCommon(input)...)
html = append(html, []byte("</body>")...)
return html
}
func startQuery() *goquery.Document {
buf := bytes.NewBuffer(readme())
query, err := goquery.NewDocumentFromReader(buf)
if err != nil {
panic(err)
}
return query
}
func checkAlphabeticOrder(t *testing.T, s *goquery.Selection) {
items := s.Find("li > a:first-child").Map(func(_ int, li *goquery.Selection) string {
return strings.ToLower(li.Text())
})
sorted := make([]string, len(items))
copy(sorted, items)
sort.Strings(sorted)
for k, item := range items {
if item != sorted[k] {
log.Printf("expected '%s' but actual is '%s'", sorted[k], item)
t.Fail()
}
}
}