verify

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package verify checks that a backup made by sync holds everything GitHub has. It is what decides whether a repo is safe to delete from GitHub, so a check that cannot run counts as a failure, never as a pass.

Index

Constants

View Source
const ReportFile = "verify-report.json"

ReportFile is the name of the report written into the target directory

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options struct {
	// Target is the backup directory
	Target string
	// AllOrgs checks the token's account plus all its orgs (User may name the account)
	AllOrgs bool
	// User checks one user's repos
	User string
	// Org checks one org's repos
	Org string
	// Gists also checks the token account's gists
	Gists bool
	// Metadata also checks the metadata export
	Metadata bool
}

Options says what to check

type Report

type Report struct {
	Time   time.Time `json:"time"`
	Target string    `json:"target"`
	OK     bool      `json:"ok"`
	// Checks names every check that ran
	Checks []string `json:"checks"`
	// Checked counts repos, wikis and gists looked at
	Checked int `json:"checked"`
	// Items names every repo, wiki and gist looked at, so a repo can be found here before deleting it
	Items []string `json:"items"`

	Missing []string `json:"missing"`
	Corrupt []string `json:"corrupt"`
	Stale   []string `json:"stale"`
	LFS     []string `json:"lfs"`
	// Submodules not checked out at the recorded commit, or failing git fsck
	Submodules []string `json:"submodules"`
	Metadata   []string `json:"metadata"`
	// Errors are checks that could not run; each one fails the backup
	Errors []string `json:"errors"`
}

Report is the outcome of a check; OK is true only when every list is empty

func (*Report) Problems

func (r *Report) Problems() int

Problems counts every entry that makes the backup not OK

type Verifier

type Verifier struct {
	// contains filtered or unexported fields
}

Verifier runs the checks

func New

func New(client github.Client, g *git.Git, opts *Options) *Verifier

New returns a Verifier; g should carry the token so private repos can be listed

func (*Verifier) Run

func (v *Verifier) Run(ctx context.Context) (*Report, error)

Run checks the backup and writes the report to <target>/verify-report.json. The report is returned even when the backup is not OK.

Jump to

Keyboard shortcuts

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