gomod2nix/main.go

34 lines
641 B
Go
Raw Normal View History

2020-07-20 10:52:58 +00:00
package main // import "github.com/tweag/gomod2nix"
import (
"flag"
"fmt"
2020-07-20 11:38:32 +00:00
"github.com/tweag/gomod2nix/fetch"
2020-07-20 12:26:57 +00:00
// "github.com/tweag/gomod2nix/formats/buildgopackage"
"github.com/tweag/gomod2nix/formats/gomod2nix"
2020-07-20 10:52:58 +00:00
"path/filepath"
)
func main() {
flag.Parse()
2020-07-20 11:29:04 +00:00
numWorkers := 20
keepGoing := true
2020-07-20 10:52:58 +00:00
directory := "./"
2020-07-20 11:38:32 +00:00
pkgs, err := fetch.FetchPackages(filepath.Join(directory, "go.mod"), filepath.Join(directory, "go.sum"), numWorkers, keepGoing)
2020-07-20 10:52:58 +00:00
if err != nil {
panic(err)
}
2020-07-20 12:26:57 +00:00
// output, err := buildgopackage.Marshal(pkgs)
output, err := gomod2nix.Marshal(pkgs)
if err != nil {
panic(err)
2020-07-20 10:52:58 +00:00
}
fmt.Println(string(output))
2020-07-20 10:52:58 +00:00
}