std

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2026 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

Package std answers which name a standard library import declares.

The table in packages.go is generated from "go list std" and holds the answer outright, so nothing here guesses. That is what lets the formatter prune an unused standard library import: the name is known, not inferred.

A path the table does not hold is not treated as standard library, whatever it looks like. A package added by a newer Go release, and a local module such as "myapp/models" whose first path element holds no dot, are both unknown until the table is regenerated, and unknown means the formatter falls back to guessing.

Index

Constants

View Source
const GeneratedFor = "go1.27"

GeneratedFor names the Go release this table was read from, as in "go1.27".

A later release adds packages the table does not hold, and Name then answers false for them, which leaves the formatter guessing rather than wrong. TestTableMatchesToolchain checks the table exactly on this release and checks only the names they share on any other.

Variables

This section is empty.

Functions

func Len

func Len() int

Len returns the number of packages in the table. Tests use it to notice an empty generation.

func Name

func Name(importPath string) (string, bool)

Name returns the name the standard library package at importPath declares.

The second result is false when the path is not in the table.

Types

This section is empty.

Jump to

Keyboard shortcuts

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