1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
Install:
go get github.com/stapelberg/godebiancontrol
…and then use it in your code:
```go
package main
import (
"github.com/stapelberg/godebiancontrol"
"os"
"log"
)
func main() {
file, err := os.Open("/var/lib/apt/lists/http.debian.net_debian_dists_testing_main_binary-amd64_Packages")
if err != nil {
log.Fatal(err)
}
defer file.Close()
p, err := godebiancontrol.Parse(file)
if err != nil {
log.Fatal(err)
}
log.Printf("The first package in the list is %s\n", p[0]["Package"])
}
```
Find the documentation at:
http://go.pkgdoc.org/github.com/stapelberg/godebiancontrol
|