Help us shape the future of Go! Take the 2026 Go Developer Survey

validation

package
v0.32.6 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package validation provides syntax validation using gofmt/goimports

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Diagnostic

type Diagnostic struct {
	Path     string `json:"path"`
	Line     int    `json:"line"`
	Column   int    `json:"column"`
	Severity string `json:"severity"`
	Message  string `json:"message"`
	Source   string `json:"source"`
}

Diagnostic represents a validation issue

type ValidationResult

type ValidationResult struct {
	Path        string       `json:"path"`
	Valid       bool         `json:"valid"`
	Errors      []Diagnostic `json:"errors,omitempty"`
	Warnings    []Diagnostic `json:"warnings,omitempty"`
	Diagnostics []Diagnostic `json:"diagnostics,omitempty"`
}

ValidationResult holds validation results

type Validator

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

Validator provides syntax and import validation

func NewValidator

func NewValidator(eventBus *events.EventBus) *Validator

NewValidator creates a new Validator

func (*Validator) RunAsyncValidation

func (v *Validator) RunAsyncValidation(ctx context.Context, path, content string)

RunAsyncValidation performs async validation without blocking

func (*Validator) RunValidation

func (v *Validator) RunValidation(ctx context.Context, path, content string) ValidationResult

RunValidation performs a full validation check

func (*Validator) SetEventMetadata

func (v *Validator) SetEventMetadata(metadata map[string]interface{})

SetEventMetadata attaches metadata merged into validation events.

func (*Validator) ValidateImports

func (v *Validator) ValidateImports(ctx context.Context, path, content string) []Diagnostic

ValidateImports checks for import issues using goimports

func (*Validator) ValidateSyntax

func (v *Validator) ValidateSyntax(ctx context.Context, path, content string) error

ValidateSyntax checks if Go code has valid syntax using gofmt

Jump to

Keyboard shortcuts

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