Skip to content

Commit fdd965a

Browse files
committed
add a simple Go program using the parser
1 parent 96bdb45 commit fdd965a

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

Diff for: .gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
.DS_Store
2+
main/main

Diff for: main/main.go

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
"github.com/docker/libcompose"
6+
"io/ioutil"
7+
)
8+
9+
func main() {
10+
11+
data, err := ioutil.ReadFile("../samples/compose.yml")
12+
if err != nil {
13+
fmt.Println("Error: unable to read ../samples/compose.yml file")
14+
return
15+
}
16+
17+
services, err := libcompose.ParseServicesYml(data)
18+
fmt.Printf("%+v\n", services)
19+
}

Diff for: samples/compose.yml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
web:
2+
image: ubuntu
3+
links:
4+
- redis
5+
redis:
6+
image: redis

0 commit comments

Comments
 (0)