ruleset

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2026 License: MIT Imports: 11 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package ruleset 渲染并分发框架规则集:.golangci.yml、.go-arch-lint.yml 与域仓库的 CI 引用文件。模板由 appkit sync 物化进各仓库,CI 做漂移检查 (见 docs/DESIGN.md §7:物化解决 IDE 集成与 golangci-lint 无配置继承的问题)。

Index

Constants

View Source
const (
	GolangciLintVersion = "v2.13.2"
	ArchLintVersion     = "v1.18.0"
)

域仓库 lint 工具链的钉版本。域仓库的 Makefile(lint 目标)与 appkit 的 .github/workflows/domain-ci.yml 必须跑同一个版本——版本不一致就会出现 「本地绿、CI 红」,而这正是规则集物化要消灭的那类事故。 两处一致由 ruleset 的 TestLinterVersionsMatchCI 守住;升级改这里。

Variables

This section is empty.

Functions

func Check

func Check(dir, version string) error

Check 比对渲染结果与磁盘内容,漂移则报错并列出文件。

func Render

func Render(cfg Config) (map[string][]byte, error)

Render 渲染全部规则集文件;key 是相对仓库根的落盘路径, 每个文件均以生成头开始(含 appkit 版本,CI 借此发现版本漂移)。

func Sync

func Sync(dir, version string) ([]string, error)

Sync 按 .appkit.yml 渲染规则集并写入 dir,返回写入的相对路径(有序)。

Types

type AppConfig

type AppConfig struct {
	Version       int      `yaml:"version"`
	Kind          string   `yaml:"kind"` // domain(默认)或 system
	Domain        string   `yaml:"domain"`
	Module        string   `yaml:"module"`
	Contracts     string   `yaml:"contracts"`
	AllowRequires []string `yaml:"allowRequires"`
	// Partitioned 是「分区域域」标记(appkit new domain -partitioned 写入)。
	// ruleset 不消费它,这里收下只为与 archcheck.Config 共用一份配置文件。
	Partitioned bool `yaml:"partitioned"`
}

AppConfig 对应 .appkit.yml(版本恒为 1)。

func LoadAppConfig

func LoadAppConfig(dir string) (AppConfig, error)

LoadAppConfig 读取并校验 dir 下的 .appkit.yml。

type Config

type Config struct {
	Domain    string // 业务包名 = Postgres schema,须匹配 ^[a-z][a-z0-9]*$
	Module    string // 域仓库 module path
	Contracts string // 合约 module path,可空
	Version   string // appkit CLI 版本,写入生成头;空则记为 (devel)
}

Config 是渲染规则集所需的域仓库信息。

Jump to

Keyboard shortcuts

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