analysis

package
v0.0.0-...-63b4fcb Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2023 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package analysis provides tools for extracting, indexing and analyzing source code archives.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConstructCodesearchIndex

func ConstructCodesearchIndex(a Archive) ([]byte, []byte)

func ConstructCtagsIndex

func ConstructCtagsIndex(a Archive) []byte

func ConstructSymbolsIndex

func ConstructSymbolsIndex(a Archive, ctags []byte) []byte

Types

type Archive

type Archive struct {
	Pkg  *apt.Package // source package
	Dir  string       // local directory
	Tree Directory    // index of package contents
	// contains filtered or unexported fields
}

An Archive represents a package that's been extracted to the local filesystem.

func DownloadExtractAndWalkTree

func DownloadExtractAndWalkTree(pkg apt.Package) Archive

DownloadExtractAndWalkTree creates an Archive from an apt.Package. It downloads the files listed in the package's control file, extracts and combines them using dpkg-source, and walks the resulting directory to create the index.

func (Archive) CleanUp

func (a Archive) CleanUp() error

CleanUp deletes the extracted archive from disk.

var a Archive = DownloadExtractAndWalkTree(...)
defer a.CleanUp()

type Directory

type Directory struct {
	Contents map[string]INode
}

func (Directory) Files

func (d Directory) Files() []File

Files recursively enumerates the directory and returns a flattened list of its contents. Nodes are added in sorted order by name.

func (Directory) MarshalJSON

func (d Directory) MarshalJSON() ([]byte, error)

type File

type File struct {
	Size      int64
	SHA256    [32]byte
	LocalPath string
}

func (File) MarshalJSON

func (f File) MarshalJSON() ([]byte, error)

type INode

type INode interface {
	// contains filtered or unexported methods
}

An INode represents anything that can be contained in a directory: a file, another directory or a symbolic link.

type Node

type Node struct {
	Name     string
	Files    []string
	Children []*Node
	// contains filtered or unexported fields
}

func ConstructFzfIndex

func ConstructFzfIndex(a Archive) Node
type SymbolicLink struct {
	SymlinkTo string
	IsDir     bool
}

func (SymbolicLink) MarshalJSON

func (s SymbolicLink) MarshalJSON() ([]byte, error)

Jump to

Keyboard shortcuts

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