garyburd/gosrc — pull request #1 by shurcooL (2013-11-24 00:39:19+00:00)
Title: Add custom service for Gists, using GitHub API for additional metainfo.

It populates Gist-specific metainfo like ProjectURL, BrowseURL for files and root folder, and LineFmt.
It uses GitHub API rather than git commands (thus it'll work in Google App Engine).
Subdirectories are not yet implemented/tested.

I used this program to test my changes:

```Go
package main

import (
"github.com/shurcooL/go-goon"
"github.com/garyburd/gosrc"
"net/http"
)

func main() {
goon.Dump(gosrc.Get(http.DefaultClient, "gist.github.com/7576154.git", ""))
}
```

Here is the diff of running the above test program before and after this PR:

```diff
@@ -1,11 +1,13 @@
+2013/11/23 14:36:22 git ls-remote --heads --tags http://gist.github.com/7576154.git
+2013/11/23 14:36:26 git clone http://gist.github.com/7576154.git /var/folders/tw/kgz4v2kn4n7d7ryg5k_z3dk40000gn/T/gddo/gist.github.com/7576154.git
(*gosrc.Directory)(&gosrc.Directory{
ImportPath: (string)("gist.github.com/7576154.git"),
ResolvedPath: (string)("gist.github.com/7576154.git"),
ProjectRoot: (string)("gist.github.com/7576154.git"),
ProjectName: (string)("7576154"),
-	ProjectURL: (string)("https://gist.github.com/7576154"),
+	ProjectURL: (string)(""),
VCS: (string)("git"),
-	Etag: (string)("603f964e7683a4f0ea2d6bfa2d4ec200075c090b"),
+	Etag: (string)("http-603f964e7683a4f0ea2d6bfa2d4ec200075c090b"),
Files: ([]*gosrc.File)([]*gosrc.File{
(*gosrc.File)(&gosrc.File{
Name: (string)("main.go"),
@@ -362,11 +364,11 @@
(uint8)(125),
(uint8)(10),
}),
-	BrowseURL: (string)("https://gist.github.com/7576154#file-main-go"),
+	BrowseURL: (string)(""),
}),
}),
Subdirectories: ([]string)([]string{}),
-	BrowseURL: (string)("https://gist.github.com/7576154"),
-	LineFmt: (string)("%s-#L%d"),
+	BrowseURL: (string)(""),
+	LineFmt: (string)(""),
})
(interface{})(nil)
```