checker

package module
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 24, 2025 License: MIT Imports: 24 Imported by: 0

Documentation

Overview

Package checker provides functions to run analyzers and linters as Go tests.

package main

import (
    "testing"

    "github.com/kisielk/errcheck/errcheck"
    "lesiw.io/checker"
)

func TestCheck(t *testing.T) {
    checker.Run(t, errcheck.Analyzer) // Run errcheck by itself.
    checker.Lint(t, "2.2.1")          // Run golangci-lint v2.2.1.
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Lint added in v0.2.0

func Lint(t *testing.T, version string)

Lint runs golangci-lint on the current package.

Version should be, e.g. "1.2.3" and not contain a "v".

func NewAnalyzer added in v0.4.0

func NewAnalyzer(analyzers ...*analysis.Analyzer) *analysis.Analyzer

NewAnalyzer creates a new analyzer that runs multiple analyzers and filters diagnostics based on //ignore directives.

func Run

func Run(t *testing.T, analyzers ...*analysis.Analyzer)

Run runs analyzers against the current package.

If the analyzers produce diagnostics, or fail to run, the test will fail.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL