Help us shape the future of Go! Take the 2026 Go Developer Survey

migration

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Rollback

func Rollback(ctx context.Context, projectDir, backupTimestamp string) error

Rollback restores a project from a backup created by Run. If backupTimestamp is empty, the most recent backup is used.

func Run

func Run(ctx context.Context, projectDir string) error

Run performs a full v1 → v2 migration. It is idempotent: running on an already-migrated project prints a message and exits cleanly.

Types

type BackupFileEntry

type BackupFileEntry struct {
	// Source is the path relative to the project directory.
	Source string `json:"source"`
	// Dest is the path relative to the backup directory.
	Dest string `json:"dest"`
}

BackupFileEntry describes a single backed-up file or directory.

type BackupInfo

type BackupInfo struct {
	Timestamp string
	Dir       string
	// Size is the total size of all files in the backup directory, in bytes.
	Size int64
}

BackupInfo describes an available backup for listing.

func ListBackups

func ListBackups(projectDir string) ([]BackupInfo, error)

ListBackups returns all available backups sorted newest-first. Returns an empty slice (not an error) when no backups exist.

type BackupManifest

type BackupManifest struct {
	Timestamp  string            `json:"timestamp"`
	ProjectDir string            `json:"project_dir"`
	Files      []BackupFileEntry `json:"files"`
}

BackupManifest records what was backed up during a migration.

type LegacyArtifact

type LegacyArtifact struct {
	Path        string
	Description string
	Action      string // what the user should do
}

LegacyArtifact describes a v1 artifact found in a project directory.

func Detect

func Detect(projectDir string) []LegacyArtifact

Detect scans the given directory for v1 artifacts. Returns an empty slice if no artifacts are found (clean v2 project or new project). No os.Exit calls — errors from file reads are treated as absent artifacts.

Jump to

Keyboard shortcuts

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