rapidloop / pgmetrics

Collect and display information and stats from a running PostgreSQL server
https://pgmetrics.io
Apache License 2.0
960 stars 65 forks source link

How to build the project #11

Closed icobg closed 6 years ago

icobg commented 6 years ago

Hello, can you provide more information about how to build the project from scratch ? I can't build it with methods on site: $ go get github.com/rapidloop/pgmetrics/... ../go/src/github.com/rapidloop/pgmetrics/cmd/pgmetrics/report.go:773:32: error: reference to undefined field or method ‘Truncate’ return time.Duration(1e6 * ms).Truncate(time.Millisecond).String()

Then I download the source code and try again: GOROOT=/root/pgmetrics-1.2.0/vendor go build ./cmd/pgmetrics cmd/pgmetrics/report.go:26:2: cannot find package "github.com/dustin/go-humanize" in any of: /root/pgmetrics-1.2.0/vendor/src/github.com/dustin/go-humanize (from $GOROOT) /root/go/src/github.com/dustin/go-humanize (from $GOPATH) cmd/pgmetrics/main.go:30:2: cannot find package "github.com/howeyc/gopass" in any of: /root/pgmetrics-1.2.0/vendor/src/github.com/howeyc/gopass (from $GOROOT) /root/go/src/github.com/howeyc/gopass (from $GOPATH) cmd/pgmetrics/collect.go:32:2: cannot find package "github.com/lib/pq" in any of: /root/pgmetrics-1.2.0/vendor/src/github.com/lib/pq (from $GOROOT) /root/go/src/github.com/lib/pq (from $GOPATH) cmd/pgmetrics/main.go:31:2: cannot find package "github.com/pborman/getopt" in any of: /root/pgmetrics-1.2.0/vendor/src/github.com/pborman/getopt (from $GOROOT) /root/go/src/github.com/pborman/getopt (from $GOPATH) cmd/pgmetrics/collect.go:33:2: cannot find package "github.com/rapidloop/pgmetrics" in any of: /root/pgmetrics-1.2.0/vendor/src/github.com/rapidloop/pgmetrics (from $GOROOT) /root/go/src/github.com/rapidloop/pgmetrics (from $GOPATH) cmd/pgmetrics/main.go:33:2: cannot find package "golang.org/x/crypto/ssh/terminal" in any of: /root/pgmetrics-1.2.0/vendor/src/golang.org/x/crypto/ssh/terminal (from $GOROOT) /root/go/src/golang.org/x/crypto/ssh/terminal (from $GOPATH)

Thanks

mdevan commented 6 years ago

You'll need Go v1.9 or later to build pgmetrics. Once you have that, you can do:

go get -u github.com/rapidloop/pgmetrics/cmd/pgmetrics

which should pull in the dependencies also.

mdevan commented 6 years ago

Hope that worked. Closing this issue, feel free to reopen if needed.