• Get Review Board
  • What's New
  • Products
  • Review Board Code review, image review, and document review
  • Documentation
  • Release Notes
  • Power Pack Enterprise integrations, reports, and enhanced document review
  • Try for 60 Days
  • Purchase
  • RBCommons Review Board as a Service, hosted by us
  • Pricing
  • RBTools Command line tools and Python API for Review Board
  • Documentation
  • Release Notes
  • Review Bot Automated code review, connecting tools you already use
  • Documentation
  • Release Notes
  • RB Gateway Manage Git and Mercurial repositories in your network
  • Documentation
  • Release Notes
  • Learn and Explore
  • What is Code Review?
  • Documentation
  • Frequently Asked Questions
  • Support Options
  • Third-Party Integrations
  • Demo
  • Review Board RBTools Power Pack Review Bot Djblets RB Gateway
    1. Review Bot 4.x
    2. Version 4.x
    3. Version 3.0
    4. Version 2.0
    5. Version 1.0
    6. Module and Class Reference
    7. reviewbot.tools.gotool
  • Home
  • Installation
  • Manually Installing Review Bot
  • Review Bot Docker Images
  • Upgrading Review Bot
  • Configuring Review Bot
  • Review Bot Tools
  • Cargo Tool
  • Checkstyle
  • Clang Static Analyzer
  • Cppcheck
  • Cpplint
  • Doc8
  • FBInfer
  • Flake8
  • Go Fmt
  • Go Tool
  • JSHint
  • PMD
  • Pycodestyle
  • Pydocstyle
  • Pyflakes
  • RuboCop
  • Rust Fmt
  • Secret Scanner
  • ShellCheck
  • Module and Class Reference
  • reviewbot.tools.base
  • reviewbot.tools.base.mixins
  • reviewbot.tools.base.registry
  • reviewbot.tools.base.tool
  • reviewbot.testing.testcases
  • reviewbot.testing.utils
  • reviewbot.tools.testing
  • reviewbot.tools.testing.decorators
  • reviewbot.tools.testing.testcases
  • reviewbot.processing.review
  • reviewbot.utils.api
  • reviewbot.utils.filesystem
  • reviewbot.utils.log
  • reviewbot.utils.process
  • reviewbot.utils.text
  • reviewbot.celery
  • reviewbot.config
  • reviewbot.deprecation
  • reviewbot.errors
  • reviewbot.repositories
  • reviewbot.tasks
  • reviewbot.tools.cargotool
  • reviewbot.tools.checkstyle
  • reviewbot.tools.clang
  • reviewbot.tools.cppcheck
  • reviewbot.tools.cpplint
  • reviewbot.tools.doc8
  • reviewbot.tools.fbinfer
  • reviewbot.tools.flake8
  • reviewbot.tools.gofmt
  • reviewbot.tools.gotool
  • reviewbot.tools.jshint
  • reviewbot.tools.pmd
  • reviewbot.tools.pycodestyle
  • reviewbot.tools.pydocstyle
  • reviewbot.tools.pyflakes
  • reviewbot.tools.rbsecretscanner
  • reviewbot.tools.rubocop
  • reviewbot.tools.rustfmt
  • reviewbot.tools.shellcheck
  • General Index
  • Python Module Index
  • Release Notes
  • reviewbot.tools.gotool¶

    Review Bot tool to run Go Tools.

    Classes

    GoTool([settings])

    Review Bot tool to run Go Tools.

    class GoTool(settings=None, **kwargs)[source]¶

    Bases: FullRepositoryToolMixin, BaseTool

    Review Bot tool to run Go Tools.

    name = 'GoTool'[source]¶

    The displayed name of the tool.

    Type:

    str

    version = '1.0'[source]¶

    The compatibility version of the tool.

    This should only be changed for major breaking updates. It will break compatibility with existing integration configurations, requiring manual updates to those configurations. Any existing configurations referencing the old version will not be run, unless an older version of the tool is being handled through another Review Bot worker providing the older tool.

    Type:

    str

    description = 'Checks Go code for test errors using built-in Go tools "go test", and "go vet".'[source]¶

    A short description of the tool.

    Type:

    str

    timeout = 90[source]¶

    Timeout for tool execution, in seconds.

    Type:

    int

    exe_dependencies = ['go'][source]¶

    A list of executable tools required by the tool.

    Each is the name of an executable on the filesystem, either in the PATH or defined in the exe_paths configuration.

    These will be checked when the worker starts. If a dependency for a tool is missing, the worker will not enable it.

    New in version 3.0: Tools that previously implemented check_dependencies() may want to be updated to use this.

    Type:

    dict

    file_patterns = ['*.go'][source]¶

    A list of filename patterns this tool can process.

    This is intended for tools that have a fixed list of file extensions or specific filenames they should process. Each entry is a glob file pattern (e.g., *.py, .config/*.xml, dockerfile, etc.), and must be lowercase (as filenames will be normalized to lowercase for comparison). See fnmatch for pattern rules.

    Tools can leave this empty to process all files, or can override get_can_handle_file() to implement custom logic (e.g., basing matching off a tool’s settings, or providing case-sensitive matches).

    New in version 3.0.

    Type:

    list of str

    options = [{'name': 'test', 'field_type': 'django.forms.BooleanField', 'default': False, 'field_options': {'label': 'Run tests', 'required': False, 'help_text': 'Run unit tests using "go test".'}}, {'name': 'vet', 'field_type': 'django.forms.BooleanField', 'default': True, 'field_options': {'label': 'Vet code', 'required': False, 'help_text': 'Run lint checks against code using "go vet".'}}][source]¶

    Configurable options defined for the tool.

    Each item in the list is a dictionary representing a form field to display in the Review Board administration UI. Keys include:

    field_type (str):

    The full path as a string to a Django form field class to render.

    name (str):

    The name/ID of the field. This will map to the key in the settings provided to handle_files() and handle_file().

    default (object, optional):

    The default value for the field.

    field_options (dict, optional):

    Additional options to pass to the form field’s constructor.

    widget (dict, optional):

    Information on the Django form field widget class used to render the field. This dictionary includes the following keys:

    type (str):

    The full path as a string to a Django form field widget class.

    attrs (dict, optional):

    A dictionary of attributes passed to the widget’s constructor.

    Type:

    list

    PACKAGE_LINE_RE = re.compile('^# (.*)$')[source]¶
    VET_ERROR_RE = re.compile('^(vet: )?(?P<path>.*\\.go):(?P<linenum>\\d+):(?P<column>\\d+): (?P<text>.*)$', re.MULTILINE)[source]¶
    get_can_handle_file(review_file, **kwargs)[source]¶

    Return whether this tool can handle a given file.

    Parameters:
    • review_file (reviewbot.processing.review.File) – The file to check.

    • **kwargs (dict, unused) – Additional keyword arguments passed to execute(). This is intended for future expansion.

    Returns:

    True if the file can be handled. False if it cannot.

    Return type:

    bool

    handle_files(files, review, **kwargs)[source]¶

    Perform a review of all files.

    Parameters:
    • files (list of reviewbot.processing.review.File) – The files to process.

    • review (reviewbot.processing.review.Review) – The review that comments will apply to.

    • **kwargs (dict) – Additional keyword arguments.

    handle_file(f, path, packages, patched_files_map, **kwargs)[source]¶

    Perform a review of a single file.

    Parameters:
    • f (reviewbot.processing.review.File) – The file to process.

    • path (str) – The local path to the patched file to review.

    • packages (set of str) – A set of all package names. This function will add the file’s package to this set.

    • patched_files_map (dict) – A mapping of paths to files being reviewed. This function will add the path and file to this map.

    • **kwargs (dict, unused) – Additional keyword arguments.

    run_go_test(package, review)[source]¶

    Execute ‘go test’ on a given package

    Parameters:
    • package (str) – Name of the go package.

    • review (reviewbot.processing.review.Review) – The review object.

    run_go_vet(package, patched_files_map)[source]¶

    Execute ‘go vet’ on a given package

    Parameters:
    • package (str) – Name of the go package.

    • patched_files_map (dict) – Mapping from filename to File to add comments.

    __annotations__ = {}¶

    Keep up with the latest Review Board releases, security updates, and helpful information.

    About
    News
    Demo
    RBCommons Hosting
    Integrations
    Happy Users
    Support Options
    Documentation
    FAQ
    User Manual
    RBTools
    Administration Guide
    Power Pack
    Release Notes
    Downloads
    Review Board
    RBTools
    Djblets
    Power Pack
    Package Store
    PGP Signatures
    Contributing
    Bug Tracker
    Submit Patches
    Development Setup
    Wiki
    Follow Us
    Mailing Lists
    Reddit
    Twitter
    Mastodon
    Facebook
    YouTube

    Copyright © 2006-2025 Beanbag, Inc. All rights reserved.

    Terms of Service — Privacy Policy — AI Ethics Policy — Branding

    On this page

    • [Top]
    • GoTool
      • GoTool.name
      • GoTool.version
      • GoTool.description
      • GoTool.timeout
      • GoTool.exe_dependencies
      • GoTool.file_patterns
      • GoTool.options
      • GoTool.PACKAGE_LINE_RE
      • GoTool.VET_ERROR_RE
      • GoTool.get_can_handle_file()
      • GoTool.handle_files()
      • GoTool.handle_file()
      • GoTool.run_go_test()
      • GoTool.run_go_vet()
      • GoTool.__annotations__