cli: moved abs path resolve to input.go

Signed-off-by: Sam Alba <sam.alba@gmail.com>
This commit is contained in:
Sam Alba
2021-04-02 17:14:01 -07:00
parent e6b0ca5109
commit a799dd05d7
3 changed files with 10 additions and 13 deletions

View File

@@ -3,6 +3,7 @@ package dagger
import (
"encoding/json"
"fmt"
"path/filepath"
"dagger.io/go/dagger/compiler"
)
@@ -82,6 +83,13 @@ type dirInput struct {
func (dir dirInput) Compile() (*compiler.Value, error) {
// FIXME: serialize an intermediate struct, instead of generating cue source
// resolve absolute path
path, err := filepath.Abs(dir.Path)
if err != nil {
return nil, err
}
dir.Path = path
// json.Marshal([]string{}) returns []byte("null"), which wreaks havoc
// in Cue because `null` is not a `[...string]`
includeLLB := []byte("[]")