splitpkg

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2025 License: BSD-3-Clause Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HTML

func HTML(pkgpath metadata.PackagePath) []byte

HTML returns the HTML for the main "Split package" page, for the /splitpkg endpoint. The real magic happens in JavaScript; see ../../server/assets/splitpkg.js.

func JSON

func JSON(pkg *cache.Package, web Web) ([]byte, error)

JSON returns the JSON encoding of the data needed by the /splitpkg-json endpoint for the specified package. It includes:

  • the set of names declared by the package, grouped by file;
  • the set of components and their assigned declarations from the most recent call to UpdateComponentsJSON; and
  • the component graph derived from them, along with the sets of reference that give rise to each edge.

func UpdateComponentsJSON

func UpdateComponentsJSON(pkgID metadata.PackageID, data []byte) error

UpdateComponentsJSON parses the JSON description of components and their assigned declarations and updates the component state for the specified package.

Types

type ComponentsJSON

type ComponentsJSON struct {
	Names       []string       `json:",omitempty"` // if empty, implied Names[0]=="default".
	Assignments map[string]int `json:",omitempty"` // maps specJSON.Name to component index; missing => 0
}

request body of a /splitpkg-components update; also part of /splitpkg-json response.

type ResultJSON

type ResultJSON struct {
	Components ComponentsJSON // component names and their assigned declarations
	Files      []*fileJSON    // files of the packages and their declarations and references
	Edges      []*edgeJSON    // inter-component edges and their references
	Cycles     [][]int        // sets of strongly-connected components
}

ResultJSON describes the result of a /splitpkg-json query. It is public for testing.

type Web

type Web interface {
	// SrcURL forms URLs that cause the editor to open a file at a specific position.
	SrcURL(filename string, line, col8 int) protocol.URI
}

Web is an abstraction of gopls' web server.

Jump to

Keyboard shortcuts

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