Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot upgrade package to v1.10.0 #120

Open
bogcon opened this issue Aug 28, 2022 · 3 comments
Open

cannot upgrade package to v1.10.0 #120

bogcon opened this issue Aug 28, 2022 · 3 comments

Comments

@bogcon
Copy link

bogcon commented Aug 28, 2022

Tag v1.9.0 has support for go 1.13 (from go mod file) and in v1.10.0 it was changed to go 1.18.
Isn't this a breaking change?

I want to upgrade dependencies of this project: https://github.com/actforgood/xconf and I get the following error:

go version
go version go1.16.4 darwin/amd64
go get -u
# go.uber.org/atomic
../../../go/pkg/mod/go.uber.org/atomic@v1.10.0/error.go:55:12: x.v.CompareAndSwap undefined (type Value has no field or method CompareAndSwap)
../../../go/pkg/mod/go.uber.org/atomic@v1.10.0/error.go:61:24: x.v.Swap undefined (type Value has no field or method Swap)
../../../go/pkg/mod/go.uber.org/atomic@v1.10.0/string.go:58:12: x.v.CompareAndSwap undefined (type Value has no field or method CompareAndSwap)
../../../go/pkg/mod/go.uber.org/atomic@v1.10.0/string.go:64:12: x.v.Swap undefined (type Value has no field or method Swap)
note: module requires Go 1.18

Methods Swap and CompareAndSwap from atomic.Value were introduced in go1.17.

Bellow is a Dockerfile the issue can be reproduced with.
Playing with image tag from top you can see that on 1.16 error is encountered, on 1.18 everything works smoothly.

FROM golang:1.16.0-alpine3.13
# FROM golang:1.18.0-alpine3.15

RUN apk add --no-cache git

RUN git clone https://github.com/actforgood/xconf /xconf

WORKDIR /xconf

CMD ["go", "get", "go.uber.org/atomic@v1.10.0"]
docker build -q -f Dockerfile -t test_upgrade .
docker run --name test_container test_upgrade
docker rm test_container
docker image rm test_upgrade
@abhinav
Copy link
Collaborator

abhinav commented Sep 6, 2022

Hey @bogcon, thanks for reporting the issue.
With go.uber.org/atomic, and most of our other projects,
we follow the same support policy as Go:
only the current and the previous minor version are supported.
With the release of Go 1.19, we only support Go 1.18 and 1.19.

That said, we understand your problem, so we can try to add back support for 1.16
by moving CompareAndSwap and Swap for Error and String into a build-tagged file.


RE: changing the go directive:
No, that's not a breaking change.
That doesn't change whether you can use the package in a version of Go older than what the directive says.
Usage with 1.16 broke because we're using features from 1.17 without gating them with build tags.

(Internal ref: GO-1641)

@bogcon
Copy link
Author

bogcon commented Sep 6, 2022

Hi @abhinav ,
Thanks for replying. If it doesn't worth the effort of maintaining 2 versions of some functionality based on go (version) build tags, don't do it just for me. I can handle it. Maybe it's better to leave the issue opened and see if others report it too and need it, and only then take into consideration supporting it.
Note the Google Cloud Functions runtime is 1.16 based currently, for example: https://cloud.google.com/functions/docs/concepts/go-runtime .

@abhinav
Copy link
Collaborator

abhinav commented Sep 6, 2022

Ack. Looking at the implementation, it's not as straightforward.
The system would have to duplicate the old CAS implementations.
I'm going to elect to not do this for now, but leave the issue open as you suggested.
Thanks for understanding!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants