Skip to content

Commit 2440fb0

Browse files
stasadevglours
authored andcommitted
Update README.md for v2
Signed-off-by: Stanislav Zhuk <[email protected]>
1 parent 6f3ef94 commit 2440fb0

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

README.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,29 @@ Go reference library for parsing and loading Compose files as specified by the
1111
package main
1212

1313
import (
14+
"context"
1415
"fmt"
15-
"github.com/compose-spec/compose-go/loader"
16-
"github.com/compose-spec/compose-go/types"
1716
"log"
17+
18+
"github.com/compose-spec/compose-go/v2/cli"
1819
)
1920

2021
func main() {
2122
composeFilePath := "docker-compose.yml"
2223
projectName := "my_project"
24+
ctx := context.Background()
2325

24-
options, err := loader.NewProjectOptions(
26+
options, err := cli.NewProjectOptions(
2527
[]string{composeFilePath},
26-
types.WithOsEnv,
27-
types.WithDotEnv,
28-
types.WithName(projectName),
28+
cli.WithOsEnv,
29+
cli.WithDotEnv,
30+
cli.WithName(projectName),
2931
)
3032
if err != nil {
3133
log.Fatal(err)
3234
}
3335

34-
project, err := loader.ProjectFromOptions(options)
36+
project, err := cli.ProjectFromOptions(ctx, options)
3537
if err != nil {
3638
log.Fatal(err)
3739
}
@@ -44,7 +46,6 @@ func main() {
4446

4547
fmt.Println(string(projectYAML))
4648
}
47-
4849
```
4950

5051
## Build the library

0 commit comments

Comments
 (0)