Git Product home page Git Product logo

gogetdoc's Introduction

gogetdoc

Build Status Go Report Card

Retrieve documentation for items in Go source code.

Go has a variety of tools that make it easy to lookup documentation. There's the godoc HTTP server, the go doc command line tool, and https://godoc.org.

These tools are great, but in many cases one may find it valuable to lookup documentation right from their editor. The problem with all of these tools is that they are all meant to be used by a person who knows what they are looking for. This makes editor integration difficult, as there isn't an easy way to say "get me the documentation for this item here."

The gogetdoc tool aims to make it easier for editors to provide access to Go documentation. Simply give it a filename and offset within the file and it will figure out what you're referring to and find the documentation for it.

Usage

Simply specify a filename and byte offset with the pos flag:

$ gogetdoc -pos "$(go env GOROOT)/src/fmt/format.go:#2351"
import "unicode/utf8"

func RuneCountInString(s string) (n int)

RuneCountInString is like RuneCount but its input is a string.

The -json flag can be used to enable the extended JSON output. In this mode, a JSON object will be written to stdout instead of the raw doc.

{
  "name": "RuneCountInString",
  "import": "unicode/utf8",
  "pkg": "utf8",
  "decl": "func RuneCountInString(s string) (n int)",
  "doc": "RuneCountInString is like RuneCount but its input is a string.\n",
  "pos": "/usr/local/Cellar/go/1.9/libexec/src/unicode/utf8/utf8.go:412:6"
}

Unsaved files

gogetdoc supports the same archive format as guru (formerly oracle). Editors can supply gogetdoc with the contents of unsaved buffers by using the -modified flag and writing an archive to stdin. Files in the archive will be preferred over those on disk.

Each archive entry consists of:

  • the file name, followed by a newline
  • the (decimal) file size, followed by a newline
  • the contents of the file

Editor Support

The following editor plugins are known to support gogetdoc:

Contributions

Are more than welcome! For small changes feel free to open a pull request. For larger changes or major features please open an issue to discuss.

Credits

The following resources served as both inspiration for starting this tool and help coming up with the implementation.

License

gogetdoc is licensed under the 3-Clause BSD license - see the LICENSE file for details.

Portions of this code are borrowed from the Go project and are Copyright 2015 The Go Authors.

gogetdoc's People

Contributors

zmb3 avatar dominikh avatar pityonline avatar creker avatar jakemingolla avatar leighmcculloch avatar marwan-at-work avatar flw-cn avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.