forked from dmacvicar/terraform-provider-libvirt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
39 lines (31 loc) · 719 Bytes
/
main.go
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
34
35
36
37
38
39
package main
import (
"flag"
"fmt"
"io"
"math/rand"
"os"
"time"
"github.com/dmacvicar/terraform-provider-libvirt/libvirt"
"github.com/hashicorp/terraform-plugin-sdk/plugin"
)
var version = "was not built correctly" // set via the Makefile
func main() {
versionFlag := flag.Bool("version", false, "print version information and exit")
flag.Parse()
if *versionFlag {
printVersion(os.Stdout)
os.Exit(0)
}
defer libvirt.CleanupLibvirtConnections()
plugin.Serve(&plugin.ServeOpts{
ProviderFunc: libvirt.Provider,
})
}
func printVersion(writer io.Writer) error {
_, err := fmt.Fprintf(writer, "%s %s\n", os.Args[0], version)
return err
}
func init() {
rand.Seed(time.Now().UTC().UnixNano())
}