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

dependencies: Replace square/go-jose.v2 with go-jose/go-jose.v2 #6598

Merged
merged 1 commit into from
Jan 24, 2023
Merged

dependencies: Replace square/go-jose.v2 with go-jose/go-jose.v2 #6598

merged 1 commit into from
Jan 24, 2023

Conversation

pgporada
Copy link
Member

@pgporada pgporada commented Jan 23, 2023

Work on square/go-jose v2 has stopped. Further work will be done on go-jose/go-jose v3. However, there's an important intermediary step needed which is to switch the package author from square to go-jose while maintaining the existing version tag (v2.6.0 used by boulder). If for some reason we needed a patch on the v2 branch while v3 was still being worked on, this change would allow us to make progress with one less step.

See upstream go-jose/go-jose for patch history.

Here's how I performed this upgrade

$ grep -rli 'gopkg.in/square/go-jose.v2' 2>/dev/null | egrep -v '(.gocache|bin/|vendor/|.git)' | xargs -i@ sed -i 's|square/go-jose.v2|go-jose/go-jose.v2|g' @
$ rm go.sum
$ go mod vendor
$ go mod tidy

…go-jose/go-jose`.

Additionally, work on `square/go-jose v2` has stopped. Further work will be done on
`go-jose/go-jose v3`. However, there's an important intermediary step needed which
is to switch the package author from square to go-jose while maintaining the
existing version tag. If for some reason we needed a patch on the v2 branch
while v3 was still being worked on, this change would allow us to make progress with
one less step.

See [upstream go-jose/go-jose](go-jose/go-jose#28) for
patch history.

Here's how I performed this upgrade
```
grep -rli 'gopkg.in/square/go-jose.v2' 2>&1 | grep -v grep | grep -v '.gocache' | grep -v 'bin/' | grep -v vendor | grep -v '.git' | xargs -i@ sed -i 's|square/go-jose.v2|go-jose/go-jose.v2|g' @

rm go.sum

go mod vendor

go mod tidy
```
@@ -77,6 +77,7 @@ require (
google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c // indirect
gopkg.in/alexcesaro/statsd.v2 v2.0.0 // indirect
gopkg.in/fsnotify.v1 v1.4.7 // indirect
gopkg.in/square/go-jose.v2 v2.6.0 // indirect
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahaha this has shows us something kinda funny. Why is square/go-jose still showing up in our indirect dependencies? Because the go-jose package has two subpackages (specifically /cipher and /json) which it imports... and the go-jose/go-jose version of the repo hasn't re-written those import statements!

I think this is totally fine -- this PR is still a step in the right direction, and it'll make future version upgrades easier. Just amusing to note.

Copy link
Member Author

@pgporada pgporada Jan 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw that too, but was not sure how you figured out /cipher and /json still come from square/go-jose other than just grepping. I thought it may have been some other package boulder uses is using square/go-jose... which I guess is this case.

Copy link
Member Author

@pgporada pgporada Jan 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could fix those statements and then make a v2.6.1 tag. I think I would prefer to do that.

Copy link
Contributor

@aarongable aarongable Jan 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I figured it out by looking at modules.txt, which still lists

gopkg.in/square/go-jose.v2/cipher
gopkg.in/square/go-jose.v2/json

edit: oops I answered the wrong question. I totally just figured it out by grepping :P I cded into the vendor/ directory, searched for "square/go-jose", and saw that it was files in go-jose that included that string.

Updating the v2 branch to reference itself, tagging 2.6.1, and updating our dependency here is definitely a solution. Personally, I think using your other PR to skip straight to v3.x is the better ("more holistic") solution.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The go-jose/go-jose v2 branch already completed this work via

When do you think would be an appropriate time to start using v3 instead of using the proposed v2.6.1?

@beautifulentropy beautifulentropy changed the title Swap square/go-jose.v2 for go-jose/go-jose.v2 dependencies: Replace square/go-jose.v2 with go-jose/go-jose.v2 Jan 24, 2023
@beautifulentropy beautifulentropy merged commit 26e5b24 into letsencrypt:main Jan 24, 2023
@pgporada pgporada deleted the switch-from-square-go-jose-to-go-jose-go-jose-v2 branch January 24, 2023 18:07
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

Successfully merging this pull request may close these issues.

3 participants