jschaf / pggen

Generate type-safe Go for any Postgres query. If Postgres can run the query, pggen can generate code for it.
MIT License
282 stars 26 forks source link

confusing installation procedure. #16

Closed sadmansakib closed 3 years ago

sadmansakib commented 3 years ago

First of all thank your for this super interesting project. I am using pgx on a project of mine and i found pggen to be a good match for generating go codes. Now I suppose using the command given on documentation is supposed to install pggen binary on GOPATH or am i missing something? On my end the command does not install pggen binary on GOPATH thus make in totally inaccessible. My GO version is 1.16

jschaf commented 3 years ago

The proper fix is to add releases to the project that folks can download.

Looks like Go 1.16 turned on modules by default which is probably why it's not working. As a workaround you can build from source or try:

GO111MODULE=off go get -u github.com/jschaf/pggen

I tried it and it's broken because looks like Docker has vendored dependencies.

/go/src/github.com/jschaf/pggen/internal/pgdocker/pgdocker.go:213:3: cannot use "github.com/docker/go-connections/nat".PortSet literal (type "github.com/docker/go-connections/nat".PortSet) as type "github.com/docker/docker/vendor/github.com/docker/go-connections/nat".PortSet in field value
/go/src/github.com/jschaf/pggen/internal/pgdocker/pgdocker.go:217:3: cannot use "github.com/docker/go-connections/nat".PortMap literal (type "github.com/docker/go-connections/nat".PortMap) as type "github.com/docker/docker/vendor/github.com/docker/go-connections/nat".PortMap in field value
sadmansakib commented 3 years ago

I found a workaround. I was able to install pggen binary on GOPATH by simply using

go get github.com/jschaf/pggen/cmd/pggen

jschaf commented 3 years ago

I've updated the README with instructions for precompiled binaries. The binaries are generated with each commit to the main branch: https://github.com/jschaf/pggen#install