Merge pull request #381 from lucidlime/i339
Return all packages from database.Packages
diff --git a/database/database.go b/database/database.go
index 259ce17..584a027 100644
--- a/database/database.go
+++ b/database/database.go
@@ -467,7 +467,7 @@
return subdirs, err
}
-// Get gets the package documenation and sub-directories for the the given
+// Get gets the package documentation and sub-directories for the the given
// import path.
func (db *Database) Get(path string) (*doc.Package, []Package, time.Time, error) {
c := db.Pool.Get()
@@ -515,7 +515,7 @@
return redis.call('HDEL', 'ids', path)
`)
-// Delete deletes the documenation for the given import path.
+// Delete deletes the documentation for the given import path.
func (db *Database) Delete(path string) error {
c := db.Pool.Get()
defer c.Close()
@@ -776,7 +776,7 @@
c.Send("SCAN", cursor, "MATCH", "pkg:*")
c.Flush()
for {
- // Recieve previous SCAN.
+ // Receive previous SCAN.
values, err := redis.Values(c.Receive())
if err != nil {
return err
diff --git a/database/database_test.go b/database/database_test.go
index 1ab5c5a..5d21e78 100644
--- a/database/database_test.go
+++ b/database/database_test.go
@@ -121,7 +121,7 @@
}
actualImporters, err := db.Importers("github.com/user/repo/foo/bar")
if err != nil {
- t.Fatalf("db.Importers() retunred error %v", err)
+ t.Fatalf("db.Importers() returned error %v", err)
}
expectedImporters := []Package{{"github.com/user/repo/foo/bar", "hello"}}
if !reflect.DeepEqual(actualImporters, expectedImporters) {
@@ -129,7 +129,7 @@
}
actualImports, err := db.Packages(pdoc.Imports)
if err != nil {
- t.Fatalf("db.Imports() retunred error %v", err)
+ t.Fatalf("db.Imports() returned error %v", err)
}
for i := range actualImports {
if actualImports[i].Path == "C" {
diff --git a/deploy/redis.conf b/deploy/redis.conf
index e2b3ee7..37f34be 100644
--- a/deploy/redis.conf
+++ b/deploy/redis.conf
@@ -263,7 +263,7 @@
#
# A slave with a low priority number is considered better for promotion, so
# for instance if there are three slaves with priority 10, 100, 25 Sentinel will
-# pick the one wtih priority 10, that is the lowest.
+# pick the one with priority 10, that is the lowest.
#
# However a special priority of 0 marks the slave as not able to perform the
# role of master, so a slave with priority of 0 will never be selected by
diff --git a/doc/code.go b/doc/code.go
index af2b537..7e35c54 100644
--- a/doc/code.go
+++ b/doc/code.go
@@ -73,7 +73,7 @@
type AnnotationKind int16
const (
- // Link to export in package specifed by Paths[PathIndex] with fragment
+ // Link to export in package specified by Paths[PathIndex] with fragment
// Text[strings.LastIndex(Text[Pos:End], ".")+1:End].
LinkAnnotation AnnotationKind = iota
diff --git a/gosrc/github.go b/gosrc/github.go
index 0de8968..4a37388 100644
--- a/gosrc/github.go
+++ b/gosrc/github.go
@@ -109,6 +109,13 @@
}
if _, err := c.getJSON(expand("https://api.github.com/repos/{owner}/{repo}/contents{dir}?ref={tag}", match), &contents); err != nil {
+ // The GitHub content API returns array values for directories
+ // and object values for files. If there's a type mismatch at
+ // the beginning of the response, then assume that the path is
+ // for a file.
+ if e, ok := err.(*json.UnmarshalTypeError); ok && e.Offset == 1 {
+ return nil, NotFoundError{Message: "Not a directory"}
+ }
return nil, err
}
diff --git a/gosrc/gosrc_test.go b/gosrc/gosrc_test.go
index 84e81f3..e4daf47 100644
--- a/gosrc/gosrc_test.go
+++ b/gosrc/gosrc_test.go
@@ -48,7 +48,7 @@
`<meta name="go-import" content="">` +
// go-source with wrong number of fields
`<meta name="go-source" content="alice.org/pkg blah">` +
- // meta tag for a differnt package
+ // meta tag for a different package
`<meta name="go-import" content="alice.org/other git https://github.com/alice/other">` +
// meta tag for a different package
`<meta name="go-import" content="alice.org/other git https://github.com/alice/other">` +