Skip to content

Commit 4a27795

Browse files
committed
cue/load: set the absolute file name when setting source
This means that when the file is decoded, the `internal/encoding.NewDecoder` logic can find it, even though `internal/encoding.Config` doesn't contain a directory field to interpret relative file paths. This fixes a test failure that happens when the modules experiment flag is enabled by default. Signed-off-by: Roger Peppe <[email protected]> Change-Id: Ia606ce2dc0fca816f3986c24fda96041862b0297 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1194830 TryBot-Result: CUEcueckoo <[email protected]> Unity-Result: CUE porcuepine <[email protected]> Reviewed-by: Daniel Martí <[email protected]>
1 parent b57a20a commit 4a27795

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

cue/load/import.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,8 @@ func setFileSource(cfg *Config, f *build.File) error {
250250
}
251251
if !filepath.IsAbs(fullPath) {
252252
fullPath = filepath.Join(cfg.Dir, fullPath)
253+
// Ensure that encoding.NewDecoder will work correctly.
254+
f.Filename = fullPath
253255
}
254256
if fi := cfg.fileSystem.getOverlay(fullPath); fi != nil {
255257
if fi.file != nil {

0 commit comments

Comments
 (0)