Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/imjasonh/go-gist

Go import redirector for GitHub Gists
https://github.com/imjasonh/go-gist

Last synced: about 1 month ago
JSON representation

Go import redirector for GitHub Gists

Awesome Lists containing this project

README

        

go-gist
=======

Ever see some tasty Go code in a [GitHub Gist][1] and want to try it out? What are you supposed to do, clone it into your own GitHub repo and `go get` it from there? Copy it locally? What are you? A farmer?

What you really want is to `import "gist.github.com/UserName/11235813"`, but Gists don't support that. :cry:

Which is why I made this simple app to solve a problem. Instead of `import "gist.github.com/..."`, `import "go-gist.appspot.com/..."`, and the site will tell the Go tool to go fetch the contents of the Gist.

It's all described [in the docs][0]. Those guys thought of everything.

Try it out:
```
go get go-gist.appspot.com/ImJasonH/7791518
```
or
```
go get go-gist.appspot.com/ImJasonH/7791518/readyset
```

Then:

```
import (
//...
readyset "go-gist.appspot.com/ImJasonH/7791518"
)
```
or

```
import (
//...
"go-gist.appspot.com/ImJasonH/7791518/readyset"
)
```

By the way, this would be totally unnecessary if the Gist HTML page was served with the necessary `` tag. If you work at GitHub or know someone who does, bug them to add a tag to their Gist HTML so I can turn this site off.

[0]: http://golang.org/cmd/go/#hdr-Remote_import_paths
[1]: http://gist.github.com

----------

License
-----

Copyright 2014 Jason Hall

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.