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

v4a

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ActionAdd    ActionType = "add"
	ActionDelete ActionType = "delete"
	ActionUpdate ActionType = "update"
	ModeKeep     string     = "keep"
	ModeAdd      string     = "add"
	ModeDelete   string     = "delete"
)

Variables

This section is empty.

Functions

func ApplyPatch

func ApplyPatch(cc FileSystem, patchText string) (string, error)

Types

type ActionType

type ActionType string

--------------------------------------------------------------------------- //

Domain objects

--------------------------------------------------------------------------- //

type Chunk

type Chunk struct {
	OrigIndex int
	DelLines  []string
	InsLines  []string
}

type Commit

type Commit struct {
	Changes map[string]FileChange
}

type DiffError

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

func (*DiffError) Error

func (e *DiffError) Error() string

type FileChange

type FileChange struct {
	Type       ActionType
	OldContent *string
	NewContent *string
	MovePath   string
}

type FileSystem

type FileSystem interface {
	Open(string) (string, error)
	Write(string, string) error
	Remove(string) error
}

type OpenFn

type OpenFn func(string) (string, error)

type Parser

type Parser struct {
	CurrentFiles map[string]string
	Lines        []string
	Index        int
	Patch        Patch
	Fuzz         int
}

type Patch

type Patch struct {
	Actions map[string]*PatchAction
}

type PatchAction

type PatchAction struct {
	Type     ActionType
	NewFile  *string
	Chunks   []Chunk
	MovePath string
}

type RemoveFn

type RemoveFn func(string) error

type WriteFn

type WriteFn func(string, string) error

Jump to

Keyboard shortcuts

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