Documentation
¶
Overview ¶
Package scriptshare finds the functions a script being saved shares with the deployment's libraries and other scripts (#2273).
Libraries exist and work (#1941), and an agent writing its tenth automation still writes its own copy of the pagination helper the other nine carry, because nothing tells it the function already exists. The save gate reads every saved source anyway, so it can see a duplicate at the moment one is written and say so in the response the agent reads: the library and version that already holds the function and the load line that replaces the copy, or the scripts that also define it. A match is reported and never refused.
Two functions match when their bodies are the same after normalization: the docstring, comments, formatting, the function's own name and the names of its parameters and local variables do not count. Anything else -- a constant, an operator, a call, the shape of a statement -- does, so a function that differs in one expression is a different function.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ListProperties ¶
ListProperties is the schema fragment for ListInput.
Types ¶
type ListInput ¶
type ListInput struct {
Library *bool `json:"library,omitempty"`
}
ListInput is manage_script list's library filter (#2273): true lists the libraries alone, false the scripts that run, and leaving it out both.
type Match ¶
type Match struct {
// Function is the function's name in the saved source.
Function string `json:"function"`
// Library, Version and LibraryFunction name the library holding the same
// function and its name there, and Load is the line that replaces the copy.
Library string `json:"library,omitempty"`
Version int `json:"version,omitempty"`
LibraryFunction string `json:"library_function,omitempty"`
Load string `json:"load,omitempty"`
// Scripts are the other scripts that define it, when no library does.
Scripts []string `json:"scripts,omitempty"`
// Next is what to do about it.
Next string `json:"next"`
}
Match is one function of the saved source that already exists elsewhere. It names functions and scripts, never source.