diff

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package diff provides utilities for comparing package versions.

Index

Constants

View Source
const (

	// Diff type constants for FileDiff.Type.
	TypeModified = "modified"
	TypeAdded    = "added"
	TypeDeleted  = "deleted"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CompareResult

type CompareResult struct {
	Files        []FileDiff `json:"files"`
	TotalAdded   int        `json:"total_added"`
	TotalDeleted int        `json:"total_deleted"`
	FilesChanged int        `json:"files_changed"`
	FilesAdded   int        `json:"files_added"`
	FilesDeleted int        `json:"files_deleted"`
}

CompareResult contains the complete comparison between two versions.

func Compare

func Compare(oldReader, newReader archives.Reader) (*CompareResult, error)

Compare generates a diff between two archive readers.

type FileDiff

type FileDiff struct {
	Path         string `json:"path"`
	Type         string `json:"type"` // "modified", "added", "deleted", "renamed"
	OldPath      string `json:"old_path,omitempty"`
	Diff         string `json:"diff,omitempty"`
	IsBinary     bool   `json:"is_binary,omitempty"`
	LinesAdded   int    `json:"lines_added"`
	LinesDeleted int    `json:"lines_deleted"`
}

FileDiff represents the diff for a single file.

Jump to

Keyboard shortcuts

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