apply

package
v0.5.6 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package apply brings a project in line with its platformgo.yaml.

A plan compares three things: what generation produces now, what the project has on disk, and what platformgo.lock says was applied before. From that it knows which files to write, which files a newly enabled module needs, and which generated files belong to a module that is gone. That last part is what makes removing a module a one line edit.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Plan

type Plan struct {
	Service string
	Modules []string
	Diff    lock.Diff

	Create    []string         // files a module needs and the project does not have yet
	Write     []string         // generated files that differ from the project
	Delete    []string         // generated files of removed modules
	Kept      []string         // generated files of removed modules that were edited by hand
	AddTools  []registry.Tool  // tools of enabled modules missing from go.mod
	DropTools []string         // tools of removed modules still declared in go.mod
	LockStale bool             // platformgo.lock does not match
	Codemods  []codemod.Change // project files rewritten for changes of kit
	// contains filtered or unexported fields
}

Plan is what apply would do to a project.

func Build

func Build(dir string) (*Plan, error)

Build reads the project and computes the plan without changing anything.

func (*Plan) Execute

func (p *Plan) Execute() error

Execute carries out the plan: creates, writes, deletes and records the lock.

func (*Plan) Pending

func (p *Plan) Pending() []string

Pending lists every path apply would touch, for messages.

func (*Plan) UpToDate

func (p *Plan) UpToDate() bool

UpToDate reports whether the project already matches its description.

Jump to

Keyboard shortcuts

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