package modindex
import "golang.org/x/tools/internal/modindex"
Package modindex contains code for building and searching an index to the Go module cache. The directory containing the index, returned by IndexDir(), contains a file index-name-<ver> that contains the name of the current index. We believe writing that short file is atomic. ReadIndex reads that file to get the file name of the index. WriteIndex writes an index with a unique name and then writes that name into a new version of index-name-<ver>. (<ver> stands for the CurrentVersion of the index format.)
Index ¶
- Constants
- Variables
- func DirToImportPathVersion(dir Relpath) (string, string, error)
- func IndexModCache(cachedir string, clear bool) error
- type Abspath
- type Entry
- type Index
- type Relpath
Constants ¶
const CurrentVersion int = 0
CurrentVersion tells readers about the format of the index.
Variables ¶
var IndexDir = indexDir
tests can override this
Functions ¶
func DirToImportPathVersion ¶
DirToImportPathVersion computes import path and semantic version
func IndexModCache ¶
Modindex writes an index current as of when it is called. If clear is true the index is constructed from all of GOMODCACHE otherwise the index is constructed from the last previous index and the updates to the cache.
Types ¶
type Abspath ¶
type Abspath string // absolute paths
distinguish various types of directory names. It's easy to get confused.
type Entry ¶
type Entry struct { Dir Relpath // directory in modcache ImportPath string PkgName string Version string //ModTime STime // is this useful? Names []string // exported names and information }
An Entry contains information for an import path.
type Index ¶
type Index struct { Version int Cachedir Abspath // The directory containing the module cache Changed time.Time // The index is up to date as of Changed Entries []Entry }
Index is returned by ReadIndex().
func ReadIndex ¶
ReadIndex reads the latest version of the on-disk index for the cache directory cd. It returns nil if there is none, or if there is an error.
type Relpath ¶
type Relpath string // paths with GOMODCACHE prefix removed
Source Files ¶
directories.go index.go modindex.go types.go
- Version
- v0.26.0
- Published
- Oct 4, 2024
- Platform
- linux/amd64
- Imports
- 16 packages
- Last checked
- 14 minutes ago –
Tools for package owners.