tools: Add godoc tool for golang files.
This commit is contained in:
parent
8c870367df
commit
c2bd5ecaad
2 changed files with 13 additions and 2 deletions
|
|
@ -42,4 +42,4 @@ Extensions | Tools
|
|||
.a .so | [nm](https://linux.die.net/man/1/nm)
|
||||
.png .jpg .gif .bmp .ppm .tiff .tga | [pil](http://python-pillow.github.io/) • [pil_half](http://python-pillow.github.io/)
|
||||
.bash .sh .dash .ksh | [shellcheck](http://hackage.haskell.org/package/ShellCheck)
|
||||
.go | [gofmt](https://golang.org) • [go_vet](https://golang.org)
|
||||
.go | [gofmt](https://golang.org) • [go_vet](https://golang.org) • [godoc](http://golang.org/x/tools)
|
||||
|
|
|
|||
|
|
@ -623,6 +623,17 @@ def git_log(path):
|
|||
return Status.not_applicable, fill3.Text("")
|
||||
|
||||
|
||||
@deps(deps={"golang-golang-x-tools"}, url="golang-golang-x-tools",
|
||||
executables={"godoc"})
|
||||
def godoc(path):
|
||||
with tempfile.TemporaryDirectory() as temp_dir:
|
||||
symlink_path = os.path.join(temp_dir, "file.go")
|
||||
os.symlink(os.path.abspath(path), symlink_path)
|
||||
stdout, stderr, returncode = _do_command(["godoc", "."], cwd=temp_dir)
|
||||
os.remove(symlink_path)
|
||||
return Status.normal, fill3.Text(stdout)
|
||||
|
||||
|
||||
def make_tool_function(dependencies, url, executables, command,
|
||||
success_status=None, error_status=None):
|
||||
command = command.split()
|
||||
|
|
@ -789,7 +800,7 @@ TOOLS_FOR_EXTENSIONS = \
|
|||
(["a", "so"], [nm]),
|
||||
(IMAGE_EXTENSIONS, [pil, pil_half]),
|
||||
(["bash", "sh", "dash", "ksh"], [shellcheck]),
|
||||
(["go"], [gofmt, go_vet])
|
||||
(["go"], [gofmt, go_vet, godoc])
|
||||
]
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue