diagnostics

package
v0.33.0 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2024 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Overview

Package diagnostics formats compiler errors and prints them in a consistent way.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Diagnostic

type Diagnostic struct {
	Pos token.Position
	Msg string
}

A single diagnostic.

func (Diagnostic) WriteTo

func (diag Diagnostic) WriteTo(w io.Writer, wd string)

Write this diagnostic to the given writer with 'wd' as the relative working directory.

type PackageDiagnostic

type PackageDiagnostic struct {
	ImportPath  string // the same ImportPath as in `go list -json`
	Diagnostics []Diagnostic
}

One or multiple errors of a particular package. It can also represent whole-program errors (like linker errors) that can't easily be connected to a single package.

func (PackageDiagnostic) WriteTo

func (pkgDiag PackageDiagnostic) WriteTo(w io.Writer, wd string)

Write package diagnostics to the given writer with 'wd' as the relative working directory.

type ProgramDiagnostic

type ProgramDiagnostic []PackageDiagnostic

Diagnostics of a whole program. This can include errors belonging to multiple packages, or just a single package.

func CreateDiagnostics

func CreateDiagnostics(err error) ProgramDiagnostic

CreateDiagnostics reads the underlying errors in the error object and creates a set of diagnostics that's sorted and can be readily printed.

func (ProgramDiagnostic) WriteTo

func (progDiag ProgramDiagnostic) WriteTo(w io.Writer, wd string)

Write program diagnostics to the given writer with 'wd' as the relative working directory.

Jump to

Keyboard shortcuts

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