go-apt-client icon indicating copy to clipboard operation
go-apt-client copied to clipboard

How Use IT?

Open Legun opened this issue 7 years ago • 1 comments

How Use it?

Legun avatar Aug 13 '18 13:08 Legun

package main

import (
	"log"

	apt "github.com/arduino/go-apt-client"
)

func main() {
	packages, err := apt.List()
	if err != nil {
		log.Fatalf("Could not fetch packages: %s", err)
	}

	log.Print("Installed packages")
	for _, p := range packages {
		if p.Status != "installed" {
			continue
		}
		log.Printf("%s: %s", p.Name, p.Version)
	}
}

soupdiver avatar Aug 17 '21 10:08 soupdiver