Skip to content

Commit e058014

Browse files
snuxollrogpeppe
authored andcommitted
internal/mod/modload: preserve custom struct in module when tidying requirements
This updates modfileFromRequirements to copy the custom struct from the original modfile to the tidied one. Fixes #3876 Closes #3877 as merged as of commit 4398218. Signed-off-by: Stefan Nuxoll <[email protected]> Change-Id: I3e1b57aeb9570aabc0da992f491a445998b80fcf Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1212931 Reviewed-by: Daniel Martí <[email protected]> Unity-Result: CUE porcuepine <[email protected]> TryBot-Result: CUEcueckoo <[email protected]>
1 parent ebf42e5 commit e058014

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed
+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
-- cue.mod/module.cue --
2+
module: "cue.example"
3+
language: {
4+
version: "v0.12.0"
5+
}
6+
custom: {
7+
"example.com/mycoolmodule": {
8+
test: "data"
9+
}
10+
}
11+
-- want --
12+
module: "cue.example"
13+
language: {
14+
version: "v0.12.0"
15+
}
16+
custom: {
17+
"example.com/mycoolmodule": {
18+
test: "data"
19+
}
20+
}

Diff for: internal/mod/modload/tidy.go

+1
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ func modfileFromRequirements(old *modfile.File, rs *modrequirements.Requirements
156156
Language: old.Language,
157157
Deps: make(map[string]*modfile.Dep),
158158
Source: old.Source,
159+
Custom: old.Custom,
159160
}
160161
defaults := rs.DefaultMajorVersions()
161162
for _, v := range rs.RootModules() {

0 commit comments

Comments
 (0)