diff --git a/internal/client/client.go b/internal/client/client.go index fcc5890..8a246f2 100644 --- a/internal/client/client.go +++ b/internal/client/client.go @@ -98,14 +98,20 @@ func (a *App) SetOutput(uri string) (err error) { // Each document has an `imports` keyword which can be used to load dependencies func (a *App) LoadDocumentImports() error { - for _, d := range a.Documents { - for _, importedDocument := range d.ImportedDocuments() { + for i, d := range a.Documents { + importedDocs := d.ImportedDocuments() + for _, importedDocument := range importedDocs { docURI := folio.URI(importedDocument.GetURI()) if _, ok := a.ImportedMap[docURI]; !ok { a.ImportedMap[docURI] = importedDocument + a.Documents = append(a.Documents, nil) + copy(a.Documents[i+1:], a.Documents[i:]) + a.Documents[i] = importedDocument +/* if _, outputErr := a.emitter.Emit(importedDocument, nil); outputErr != nil { return outputErr } +*/ } } } diff --git a/internal/resource/container_image_test.go b/internal/resource/container_image_test.go index 9ff853e..6d7e5ef 100644 --- a/internal/resource/container_image_test.go +++ b/internal/resource/container_image_test.go @@ -173,7 +173,7 @@ func TestCreateContainerImagePush(t *testing.T) { } func TestContainerImageContextDocument(t *testing.T) { - contextDir, _ := filepath.Abs(filepath.Join(TempDir, "context")) + contextDir, _ := filepath.Abs(TempDir.FilePath("context")) etcDir, _ := filepath.Abs(filepath.Join(contextDir, "etc")) binDir, _ := filepath.Abs(filepath.Join(contextDir, "bin")) diff --git a/internal/resource/pki_test.go b/internal/resource/pki_test.go index de1e3da..0a3a960 100644 --- a/internal/resource/pki_test.go +++ b/internal/resource/pki_test.go @@ -127,9 +127,9 @@ func TestPKIEncodeKeys(t *testing.T) { } func TestPKIResource(t *testing.T) { - privateKeyFile, _ := filepath.Abs(filepath.Join(TempDir, "fooprivatekey.pem")) - publicKeyFile, _ := filepath.Abs(filepath.Join(TempDir, "foopublickey.pem")) - certFile, _ := filepath.Abs(filepath.Join(TempDir, "foocert.pem")) + privateKeyFile, _ := filepath.Abs(TempDir.FilePath("fooprivatekey.pem")) + publicKeyFile, _ := filepath.Abs(TempDir.FilePath("foopublickey.pem")) + certFile, _ := filepath.Abs(TempDir.FilePath("foocert.pem")) var resourceYaml, readResourceYaml strings.Builder expected := fmt.Sprintf(` diff --git a/internal/resource/schema_test.go b/internal/resource/schema_test.go index 031f234..988a2d7 100644 --- a/internal/resource/schema_test.go +++ b/internal/resource/schema_test.go @@ -31,7 +31,7 @@ func TestSchemaValidateJSON(t *testing.T) { s := NewSchema("file") assert.NotEqual(t, nil, s) - file, _ := filepath.Abs(filepath.Join(TempDir, "fooread.txt")) + file, _ := filepath.Abs(TempDir.FilePath("fooread.txt")) expectedAtime, atimeErr := time.Parse(time.RFC3339Nano, "2001-12-15T01:01:01.000000001Z") assert.Nil(t, atimeErr)