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

source

package
v0.0.0-...-c1d734d Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: MIT Imports: 0 Imported by: 7

Documentation

Overview

Package source defines where code is: the language of a file, its path, and the positions and ranges in its bytes.

Coordinates

Offsets, lines and columns are zero-based byte counts. Position.Offset is authoritative. Position.Line and Position.Column are derived from it, so an answer is readable without the file. An engine whose protocol counts UTF-16 code units converts them to bytes before it returns a position.

Paths

A Path is slash-separated and relative to the workspace root on every platform. No port accepts or returns an absolute path.

Ranges

A Span is half-open: it includes Start and excludes End.

Dependency position

It does not import any package. The packages sema, trust, diag, edit and engine of core import it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Language

type Language string

Language identifies a programming language on requests and answers. The zero value is the empty string, which is not a language.

Each language module declares its own value, and core declares none. The language registry refuses a value that two modules declare. The value is part of every go.dokimi.dev/techne/core/sema.ID, so changing it invalidates the IDs an index has stored.

type Path

type Path string

Path is a slash-separated file path, relative to the workspace root. The zero value is the empty string, which is not a path.

type Position

type Position struct {
	// Offset is the zero-based byte offset. It is authoritative.
	Offset int `json:"offset"`
	// Line is the zero-based line of Offset.
	Line int `json:"line"`
	// Column is the zero-based byte column of Offset.
	Column int `json:"column"`
}

Position is one point in a file. The zero value is the first byte.

type Span

type Span struct {
	Path  Path     `json:"path"`
	Start Position `json:"start"`
	End   Position `json:"end"`
}

Span is a half-open range of one file: it includes Start and excludes End. A Span whose Start equals its End is an insertion point. The zero value has an empty Path.

Jump to

Keyboard shortcuts

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