1
0
forked from rosa/hakurei

internal/rosa: key-value type

This type is used very frequently. The new type is much easier to type and can receive helper methods eventually if needed.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2026-03-26 16:20:16 +09:00
parent d514d0679f
commit 2548a681e9
34 changed files with 92 additions and 85 deletions

View File

@@ -37,6 +37,9 @@ func mustDecode(s string) pkg.Checksum {
return pkg.MustDecode(s)
}
// KV is a key-value pair of strings.
type KV [2]string
var (
// AbsUsrSrc is the conventional directory to place source code under.
AbsUsrSrc = fhs.AbsUsr.Append("src")
@@ -364,7 +367,7 @@ func (t Toolchain) NewPatchedSource(
name, version string,
source pkg.Artifact,
passthrough bool,
patches ...[2]string,
patches ...KV,
) pkg.Artifact {
if passthrough && len(patches) == 0 {
return source
@@ -446,7 +449,7 @@ type PackageAttr struct {
ScriptEarly string
// Passed to [Toolchain.NewPatchedSource].
Patches [][2]string
Patches []KV
// Kind of source artifact.
SourceKind int