File tree Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -11,27 +11,29 @@ Go reference library for parsing and loading Compose files as specified by the
11
11
package main
12
12
13
13
import (
14
+ " context"
14
15
" fmt"
15
- " github.com/compose-spec/compose-go/loader"
16
- " github.com/compose-spec/compose-go/types"
17
16
" log"
17
+
18
+ " github.com/compose-spec/compose-go/v2/cli"
18
19
)
19
20
20
21
func main () {
21
22
composeFilePath := " docker-compose.yml"
22
23
projectName := " my_project"
24
+ ctx := context.Background ()
23
25
24
- options , err := loader .NewProjectOptions (
26
+ options , err := cli .NewProjectOptions (
25
27
[]string {composeFilePath},
26
- types .WithOsEnv ,
27
- types .WithDotEnv ,
28
- types .WithName (projectName),
28
+ cli .WithOsEnv ,
29
+ cli .WithDotEnv ,
30
+ cli .WithName (projectName),
29
31
)
30
32
if err != nil {
31
33
log.Fatal (err)
32
34
}
33
35
34
- project , err := loader .ProjectFromOptions (options)
36
+ project , err := cli .ProjectFromOptions (ctx, options)
35
37
if err != nil {
36
38
log.Fatal (err)
37
39
}
@@ -44,7 +46,6 @@ func main() {
44
46
45
47
fmt.Println (string (projectYAML))
46
48
}
47
-
48
49
```
49
50
50
51
## Build the library
You can’t perform that action at this time.
0 commit comments