0.0
A long-lived project that still receives updates
Pronto runner for golang tools
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 13.0
~> 3.12

Runtime

>= 0.11.0
 Project Readme

Pronto runner for Golang

Build Status RubyDoc

Pronto runner for Golang tools

Tools

Tool Install
go vet -
golint go install golang.org/x/lint/golint@latest
gosec go install github.com/securego/gosec/v2/cmd/gosec@v2.14.0
staticcheck go install honnef.co/go/tools/cmd/staticcheck@latest
golangci-lint See Install instructions

Configuring tools

In order to configure certain tools for execution it is possible to provide a .golangtools.yml file in the directory of execution, any parent directory or $HOME.

It looks as follows:

tools:
  <tool base command>:
    enabled: true
    parameters: '-v'
    blacklisted_files: '.*\/vendor\/.*'

If a tool is not listed here, it will automatically be enabled. In order to specifically disable a tool, it has to be listed and enabled has to be set to false. If either of the keys is not provided the default will be assumed. It is possible to pass specific parameters to the tool, which is executed with <tool> <parameters> <file_path>. If is also possible to skip handling specific files by providing a pattern in blacklisted_files, e.g. '.*\/vendor\/.*' to ignore vendor. It will check every file by default.

Implementing additional tools

It is possible to add additional tools by adding a new class in the Pronto::GolangTools namespace.

It is expected that it reponds to the following methods:

Method Description
initialize Configuration hash from the .golangtools.yml config
 command(file_path) Executes the command and receives the file_path to allow checking only the current file
 self.base_command Returns the name/basic command that will be invoked. Is also used for enabling and disabling it via .golangtools.yml
 available? Returns true if the tool can be found, e.g. through which #{base_command}
process_output(output) Receives the output returned from the tool for parsing. Returns an array of Output with absolute_path, line_number, level, message text

It is possible to inherit from Pronto::GolangTools::Base, in which case only self.base_command and parse_line need to be implemented.

License

MIT