golang

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package golang provides Go language support for code analysis.

This package implements the language.Language interface for Go, wrapping the existing Go-specific parsing, detection, coverage, and dependency analysis components.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GoDetectorRunner

type GoDetectorRunner struct {
	// contains filtered or unexported fields
}

GoDetectorRunner implements language.DetectorRunner for Go source code.

This runner re-parses Go files to obtain AST access and runs all enabled detectors on each function declaration. It encapsulates the Go-specific AST walking logic that was previously in analyzer.runDetectors().

func NewGoDetectorRunner

func NewGoDetectorRunner(cfg *config.AnalysisConfig) *GoDetectorRunner

NewGoDetectorRunner creates a new detector runner for Go source code.

func (*GoDetectorRunner) RunDetectors

func (r *GoDetectorRunner) RunDetectors(cfg *config.AnalysisConfig, file *parser.FileMetrics) []*detectors.Issue

RunDetectors re-parses a Go file and runs all enabled detectors.

This method:

  1. Re-parses the file to obtain a Go AST
  2. Walks all function declarations
  3. Matches each AST declaration to its corresponding FunctionMetrics
  4. Runs all enabled detectors on each matched function

Returns nil if the file cannot be parsed (e.g., syntax errors).

type GoLanguage

type GoLanguage struct{}

GoLanguage implements language.Language for Go source code.

func (*GoLanguage) CoverageRunner

func (g *GoLanguage) CoverageRunner(cfg *config.AnalysisConfig, statusReporter status.Reporter) language.CoverageRunner

CoverageRunner returns a Go test coverage runner.

func (*GoLanguage) DefaultExcludePatterns

func (g *GoLanguage) DefaultExcludePatterns() []string

DefaultExcludePatterns returns Go-specific exclude patterns.

func (*GoLanguage) DependencyAnalyzer

func (g *GoLanguage) DependencyAnalyzer(projectPath string) (language.DependencyAnalyzer, error)

DependencyAnalyzer returns a Go dependency analyzer.

func (*GoLanguage) DetectorRunner

func (g *GoLanguage) DetectorRunner(cfg *config.AnalysisConfig) language.DetectorRunner

DetectorRunner returns a Go-specific detector runner.

func (*GoLanguage) DisplayName

func (g *GoLanguage) DisplayName() string

DisplayName returns "Go".

func (*GoLanguage) Extensions

func (g *GoLanguage) Extensions() []string

Extensions returns [".go"].

func (*GoLanguage) Name

func (g *GoLanguage) Name() string

Name returns "go".

func (*GoLanguage) Parser

func (g *GoLanguage) Parser() parser.Parser

Parser returns a Go AST-based parser.

Jump to

Keyboard shortcuts

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