Giter Club home page Giter Club logo

Comments (11)

jackc avatar jackc commented on July 17, 2024

The replace was a mistake and was fixed less than an hour later. That all happened on master and was never in a tagged release. I'm not sure how your running into that.

pgx will maintain support for Go 1.18 until 1.20 is released.

puddle v2.1.0 does require Go 1.19, but pgx only requires puddle v2.0.1. Since Go uses minimal version selection for dependency resolution no one should get puddle v2.1.0 without specifically opting in. The plan is to update the dependency only after Go 1.20 is released.

If for some reason we need to update earlier, it would be possible to make puddle work with Go 1.18 again, but it would mean adding an external dependency which I prefer not to do.

from puddle.

lzap avatar lzap commented on July 17, 2024

Hmmm we do have beta versions of tern and scany libraries in our https://github.com/RHEnVision/provisioning-backend/blob/main/go.mod file and all I did was this:

lzap@mone provisioning-backend % make update-deps
go get -u all
go: downloading github.com/aws/aws-sdk-go-v2/credentials v1.12.23
go: downloading github.com/aws/aws-sdk-go-v2 v1.17.1
go: downloading github.com/getkin/kin-openapi v0.107.0
go: downloading github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs v1.16.0
go: downloading github.com/Azure/azure-sdk-for-go v67.0.0+incompatible
go: downloading github.com/stretchr/testify v1.8.1
go: downloading go.opentelemetry.io/otel v1.11.1
go: downloading github.com/deepmap/oapi-codegen v1.12.2
go: downloading google.golang.org/api v0.101.0
go: downloading cloud.google.com/go/compute v1.12.1
go: downloading cloud.google.com/go v0.105.0
go: downloading google.golang.org/genproto v0.0.0-20221027153422-115e99e71e1c
go: downloading github.com/aws/aws-sdk-go-v2/service/ec2 v1.65.0
go: downloading github.com/georgysavva/scany/v2 v2.0.0
go: downloading github.com/jackc/pgx/v5 v5.0.4
go: downloading github.com/aws/aws-sdk-go-v2/config v1.17.10
go: downloading github.com/aws/aws-sdk-go-v2/service/sts v1.17.1
go: downloading github.com/aws/smithy-go v1.13.4
go: downloading github.com/exaring/otelpgx v0.2.1
go: downloading golang.org/x/exp v0.0.0-20221031165847-c99f073a8326
go: downloading github.com/jackc/tern/v2 v2.0.0-beta.3
go: downloading go.opentelemetry.io/contrib v1.11.1
go: downloading go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.36.4
go: downloading go.opentelemetry.io/otel/trace v1.11.1
go: downloading golang.org/x/crypto v0.1.0
go: downloading go.opentelemetry.io/otel/exporters/jaeger v1.11.1
go: downloading go.opentelemetry.io/otel/sdk v1.11.1
go: downloading github.com/go-openapi/runtime v0.24.2
go: downloading github.com/prometheus/client_model v0.3.0
go: downloading golang.org/x/sys v0.1.0
go: downloading github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.25
go: downloading golang.org/x/oauth2 v0.1.0
go: downloading google.golang.org/grpc v1.50.1
go: downloading github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.19
go: downloading github.com/aws/aws-sdk-go-v2/internal/ini v1.3.26
go: downloading github.com/aws/aws-sdk-go-v2/service/sso v1.11.25
go: downloading github.com/aws/aws-sdk-go-v2/service/ssooidc v1.13.8
go: downloading github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.19
go: downloading github.com/BurntSushi/toml v1.2.1
go: downloading golang.org/x/text v0.4.0
go: downloading github.com/jackc/puddle/v2 v2.1.0
go: downloading go.opentelemetry.io/otel/metric v0.33.0
go: downloading github.com/googleapis/gax-go/v2 v2.6.0
go: downloading github.com/matttproud/golang_protobuf_extensions v1.0.4
go: downloading cloud.google.com/go/compute/metadata v0.2.1
go: downloading golang.org/x/net v0.1.0
go: downloading github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.19
go: downloading github.com/twmb/murmur3 v1.1.6
go: downloading github.com/huandu/xstrings v1.3.3
go: downloading go.mongodb.org/mongo-driver v1.10.4
go: downloading github.com/apapsch/go-jsonmerge/v2 v2.0.0
go: downloading golang.org/x/sync v0.1.0
go: downloading github.com/apapsch/go-jsonmerge v1.0.0
go: downloading github.com/stretchr/objx v0.5.0
go: downloading golang.org/x/term v0.1.0
go: module github.com/golang/protobuf is deprecated: Use the "google.golang.org/protobuf" module instead.
go: upgraded cloud.google.com/go/compute v1.10.0 => v1.12.1
go: added cloud.google.com/go/compute/metadata v0.2.1
go: upgraded github.com/BurntSushi/toml v1.2.0 => v1.2.1
go: added github.com/apapsch/go-jsonmerge/v2 v2.0.0
go: upgraded github.com/aws/aws-sdk-go-v2 v1.16.16 => v1.17.1
go: upgraded github.com/aws/aws-sdk-go-v2/config v1.17.8 => v1.17.10
go: upgraded github.com/aws/aws-sdk-go-v2/credentials v1.12.21 => v1.12.23
go: upgraded github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.17 => v1.12.19
go: upgraded github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.23 => v1.1.25
go: upgraded github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.17 => v2.4.19
go: upgraded github.com/aws/aws-sdk-go-v2/internal/ini v1.3.24 => v1.3.26
go: upgraded github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs v1.15.20 => v1.16.0
go: upgraded github.com/aws/aws-sdk-go-v2/service/ec2 v1.63.1 => v1.65.0
go: upgraded github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.17 => v1.9.19
go: upgraded github.com/aws/aws-sdk-go-v2/service/sso v1.11.23 => v1.11.25
go: upgraded github.com/aws/aws-sdk-go-v2/service/ssooidc v1.13.6 => v1.13.8
go: upgraded github.com/aws/aws-sdk-go-v2/service/sts v1.16.19 => v1.17.1
go: upgraded github.com/aws/smithy-go v1.13.3 => v1.13.4
go: upgraded github.com/deepmap/oapi-codegen v1.11.0 => v1.12.2
go: upgraded github.com/exaring/otelpgx v0.2.0 => v0.2.1
go: upgraded github.com/georgysavva/scany/v2 v2.0.0-alpha.3 => v2.0.0
go: upgraded github.com/getkin/kin-openapi v0.104.0 => v0.107.0
go: upgraded github.com/go-openapi/runtime v0.24.1 => v0.24.2
go: upgraded github.com/googleapis/gax-go/v2 v2.5.1 => v2.6.0
go: upgraded github.com/huandu/xstrings v1.3.2 => v1.3.3
go: upgraded github.com/jackc/pgx/v5 v5.0.2 => v5.0.4
go: upgraded github.com/jackc/puddle/v2 v2.0.0 => v2.1.0
go: upgraded github.com/jackc/tern/v2 v2.0.0-beta.2 => v2.0.0-beta.3
go: upgraded github.com/matttproud/golang_protobuf_extensions v1.0.2 => v1.0.4
go: upgraded github.com/prometheus/client_model v0.2.0 => v0.3.0
go: upgraded github.com/stretchr/testify v1.8.0 => v1.8.1
go: upgraded github.com/twmb/murmur3 v1.1.5 => v1.1.6
go: upgraded go.mongodb.org/mongo-driver v1.10.3 => v1.10.4
go: upgraded go.opentelemetry.io/contrib v1.10.0 => v1.11.1
go: upgraded go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.36.1 => v0.36.4
go: upgraded go.opentelemetry.io/otel v1.10.0 => v1.11.1
go: upgraded go.opentelemetry.io/otel/exporters/jaeger v1.10.0 => v1.11.1
go: upgraded go.opentelemetry.io/otel/metric v0.32.1 => v0.33.0
go: upgraded go.opentelemetry.io/otel/sdk v1.10.0 => v1.11.1
go: upgraded go.opentelemetry.io/otel/trace v1.10.0 => v1.11.1
go: upgraded golang.org/x/crypto v0.0.0-20221012134737-56aed061732a => v0.1.0
go: upgraded golang.org/x/exp v0.0.0-20221011100225-3a7871e7c0b2 => v0.0.0-20221031165847-c99f073a8326
go: upgraded golang.org/x/net v0.0.0-20221004154528-8021a29435af => v0.1.0
go: upgraded golang.org/x/oauth2 v0.0.0-20221006150949-b44042a4b9c1 => v0.1.0
go: upgraded golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 => v0.1.0
go: upgraded golang.org/x/sys v0.0.0-20221013171732-95e765b1cc43 => v0.1.0
go: upgraded golang.org/x/text v0.3.8 => v0.4.0
go: upgraded google.golang.org/api v0.98.0 => v0.101.0
go: upgraded google.golang.org/genproto v0.0.0-20221010155953-15ba04fc1c0e => v0.0.0-20221027153422-115e99e71e1c
go: upgraded google.golang.org/grpc v1.50.0 => v1.50.1
go mod tidy
go: downloading cloud.google.com/go/longrunning v0.1.1

And then:

lzap@mone provisioning-backend % make build
CGO_ENABLED=0 go build -ldflags "-X github.com/RHEnVision/provisioning-backend/internal/version.BuildCommit=304f719 -X github.com/RHEnVision/provisioning-backend/internal/version.BuildTime=2022-11-02_08:35:52" -o pbapi ./cmd/pbapi
# github.com/jackc/puddle/v2
/Volumes/SSD/Go/pkg/mod/github.com/jackc/puddle/[email protected]/pool.go:142:30: undefined: atomic.Int64
note: module requires Go 1.19

Let me take a closer look.

from puddle.

lzap avatar lzap commented on July 17, 2024

Hmm the new Go modules are still new for me, but it almost looks like pgxpool package wants it:

lzap@mone provisioning-backend % go mod why github.com/jackc/puddle/v2
# github.com/jackc/puddle/v2
github.com/RHEnVision/provisioning-backend/internal/db
github.com/jackc/pgx/v5/pgxpool
github.com/jackc/puddle/v2

from puddle.

lzap avatar lzap commented on July 17, 2024

Okay I think I found it, one of our dependencies

https://github.com/IBM/pgxpoolprometheus

contains for some reason indirect dependency

github.com/jackc/puddle/v2 v2.0.0 // indirect

https://github.com/IBM/pgxpoolprometheus/search?q=puddle

Updating our deps one by one revealed this. However, I cannot get rid of this dependency in that project. If I start over deleting go.sum and indirect deps, it does not fetch puddle at all but the moment I try to update deps:

go: upgraded github.com/jackc/pgx/v5 v5.0.1 => v5.0.4
go: upgraded github.com/jackc/puddle/v2 v2.0.0 => v2.1.0
go: upgraded github.com/matttproud/golang_protobuf_extensions v1.0.1 => v1.0.4
go: upgraded github.com/prometheus/client_model v0.2.0 => v0.3.0
go: upgraded golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90 => v0.1.0
go: upgraded golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f => v0.1.0
go: upgraded golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a => v0.1.0
go: upgraded golang.org/x/text v0.3.7 => v0.4.0

from puddle.

lzap avatar lzap commented on July 17, 2024

I am not following, even with a clean Go mod cache:

[lzap@nuc pgxpoolprometheus]$ go clean -cache
[lzap@nuc pgxpoolprometheus]$ go mod tidy
go: downloading github.com/stretchr/testify v1.8.0
go: downloading github.com/davecgh/go-spew v1.1.1
go: downloading github.com/pmezard/go-difflib v1.0.0
go: downloading github.com/stretchr/objx v0.4.0
go: downloading gopkg.in/yaml.v3 v3.0.1
go: downloading github.com/google/go-cmp v0.5.8
go: downloading gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c
go: downloading github.com/kr/pretty v0.3.0
go: downloading github.com/rogpeppe/go-internal v1.9.0
go: downloading github.com/kr/text v0.1.0
go: downloading github.com/kr/text v0.2.0
github.com/IBM/pgxpoolprometheus tested by
	github.com/IBM/pgxpoolprometheus.test imports
	github.com/stretchr/testify/assert imports
	gopkg.in/yaml.v3 tested by
	gopkg.in/yaml.v3.test imports
	gopkg.in/check.v1 imports
	github.com/kr/pretty imports
	github.com/kr/text loaded from github.com/kr/[email protected],
	but go 1.16 would select v0.2.0

To upgrade to the versions selected by go 1.16:
	go mod tidy -go=1.16 && go mod tidy -go=1.17
If reproducibility with go 1.16 is not needed:
	go mod tidy -compat=1.17
For other options, see:
	https://golang.org/doc/modules/pruning
[lzap@nuc pgxpoolprometheus]$ go mod tidy -go=1.16 && go mod tidy -go=1.17

And I am getting github.com/jackc/puddle/v2 v2.1.0 // indirect pulled in.

from puddle.

lzap avatar lzap commented on July 17, 2024

A colleague of mine tried also with older Go, the same result.

from puddle.

jackc avatar jackc commented on July 17, 2024

I just created a new pgx project and minimal version selection is working for me.

jack@glados ~/dev/pgxpuddletest » go mod init pgxpuddletest
go: creating new go.mod: module pgxpuddletest
jack@glados ~/dev/pgxpuddletest » go get github.com/jackc/pgx/v5/pgxpool
go: added github.com/jackc/pgpassfile v1.0.0
go: added github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b
go: added github.com/jackc/pgx/v5 v5.0.4
go: added github.com/jackc/puddle/v2 v2.0.0
go: added golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90
go: added golang.org/x/text v0.3.8

Note:

go: added github.com/jackc/puddle/v2 v2.0.0

from puddle.

ezr-ondrej avatar ezr-ondrej commented on July 17, 2024

@jackc right, but running go get -u all would probably pull the newest version (2.1.0), correct?

I believe it is reasonable to get the latest released version of libraries (that would be where I expect security fixes to land).
Having minor version break compatibility is making this harder 🤔

from puddle.

lzap avatar lzap commented on July 17, 2024

Yeah when I create a dummy main package importing puddle/v2, then an update pulls newer version:

[lzap@nuc puddletest]$ vim main.go
[lzap@nuc puddletest]$ go get -u ./...
go: upgraded github.com/jackc/puddle/v2 v2.0.0 => v2.1.0
go: added golang.org/x/sync v0.1.0

I do not know how module updating does work in Go, I need to read something about this right now. This might be expected behavior actually.

from puddle.

lzap avatar lzap commented on July 17, 2024

@jackc while MVS does apply when you get a dependency, it does not work when you try to update it. As you showed, it is completely fine when you start a new project, MVS gets the oldest possible version, which is 2.0.0:

[lzap@nuc puddletest]$ go mod init pgxpuddletest
go: creating new go.mod: module pgxpuddletest

[lzap@nuc puddletest]$ go get github.com/jackc/pgx/v5/pgxpool
go: added github.com/jackc/pgpassfile v1.0.0
go: added github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b
go: added github.com/jackc/pgx/v5 v5.0.4
go: added github.com/jackc/puddle/v2 v2.0.0
go: added golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90
go: added golang.org/x/text v0.3.8

However, this falls apart the moment you actually have some existing dependencies and want to update them all, which is a standard practice. You need to actually import a dependency in order to be able to update it:

[lzap@nuc puddletest]$ cat main.go
package main
import _ "github.com/jackc/pgx/v5/pgxpool"
func main() {
}

[lzap@nuc puddletest]$ go get -u
go: upgraded github.com/jackc/puddle/v2 v2.0.0 => v2.1.0
go: upgraded golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90 => v0.1.0
go: added golang.org/x/sync v0.1.0
go: upgraded golang.org/x/text v0.3.8 => v0.4.0

See, the MVS concept only works when you have multiple projects depending on a library. But in the example here and in our project with many dependencies there is only one package that needs puddle and that is pgxpool:

$ go mod why github.com/jackc/puddle/v2
# github.com/jackc/puddle/v2
github.com/RHEnVision/provisioning-backend/internal/db
github.com/jackc/pgx/v5/pgxpool
github.com/jackc/puddle/v2

Therefore MVS cannot help here, it will simply update to the latest version. I am not aware of any go command that would update me dependencies except one, or that would exclude puddle for any reason.

I am currently looking into some kind of blacklisting puddle v2.1.0 and higher because that is the only way how we can update dependencies in our project. Another approach would be upgrading them one by one, but that is tidious as we have several dozens of them already :-(

Am I missing something here? I really do not understand how this is supposed to work in this situation when an incompatible change was tagged in a major (v2) branch.

from puddle.

lzap avatar lzap commented on July 17, 2024

Ok I have found a way, immediately downgrade puddle back to v2.0.0 after updating all deps.

  .PHONY: update-deps
  update-deps: ## Update Go modules to latest versions
          go get -u all
          go get github.com/jackc/puddle/[email protected] # https://github.com/jackc/puddle/issues/26
          go get github.com/jackc/tern/[email protected] # not released yet
          go mod tidy

I guess this will break many projects once they try to update all deps, maybe this is normal, but I feel like this is a bug.

Anyway, closing, thanks for help!

from puddle.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.