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

feat!: add Go modules and Go 1.19 compatibility #114

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

zwartho
Copy link

@zwartho zwartho commented Aug 3, 2023

Fixes

This PR is based off the changes introduced in #112 by @AlaricWhitney.

Adds Go Modules, and also adds a v3 directory as per current Golang standards as per https://go.dev/blog/v2-go-modules.

This PR also makes the following changes:

  • Minor adjustments to correct compatibility up to Go 1.20
  • Adds new test-v3 job due to breaking changes
  • Updates to documentation

Checklist

  • I acknowledge that all my contributions will be made under the project's license
  • I have made a material change to the repo (functionality, testing, spelling, grammar)
  • I have read the Contribution Guidelines and my PR follows them
  • I have titled the PR appropriately
  • I have updated my branch with the main branch
  • I have added tests that prove my fix is effective or that my feature works
  • I have added the necessary documentation about the functionality in the appropriate .md file
  • I have added inline documentation to the code I modified

If you have questions, please file a support ticket.

@zwartho zwartho changed the title feat: add Go modules and Go 1.19 compatibility Draft: feat: add Go modules and Go 1.19 compatibility Aug 3, 2023
@zwartho zwartho changed the title Draft: feat: add Go modules and Go 1.19 compatibility feat: add Go modules and Go 1.19 compatibility Aug 4, 2023
@zwartho zwartho changed the title feat: add Go modules and Go 1.19 compatibility feat!: add Go modules and Go 1.19 compatibility Aug 4, 2023
@zwartho
Copy link
Author

zwartho commented Aug 4, 2023

@marcoshuck this is ready for review.

Copy link

@marcoshuck marcoshuck left a comment

Choose a reason for hiding this comment

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

First pass

@@ -36,14 +36,39 @@ jobs:
- name: Run Tests
run: make test

test-v3:

Choose a reason for hiding this comment

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

Why are we running this in a separate job? Consider including the respective Go versions in the original test job. Keep in mind while performing these changes that Go 1.20 is out already.

Choose a reason for hiding this comment

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

Ditto to the reason I explained in go commands comment.

CONTRIBUTING.md Outdated Show resolved Hide resolved

test: install
go test -race -cover -v ./...

Choose a reason for hiding this comment

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

Why are you removing the ./...?

Choose a reason for hiding this comment

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

I understand now, this change was intentional due to the subfolder, if we remove the subfolder altogether, we can revert this change.

@@ -0,0 +1,5 @@
module github.com/sendgrid/rest/v3

Choose a reason for hiding this comment

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

I don't think it's a good idea to have a different folders. We can simply replace the version in the original go.mod file instead. Please revert these changes in the v3 folder.

Choose a reason for hiding this comment

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

Even though the https://go.dev/blog/v2-go-modules recommends having different folders, that's for projects that are actually introducing breaking changes, and this is not the case in this PR.

Copy link
Author

@zwartho zwartho Aug 7, 2023

Choose a reason for hiding this comment

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

@marcoshuck Thanks for your review. If you take a look at these failed jobs, breaking changes are seemingly apparent when referencing the io module. This SO question explains it nicely, but essentially the only Go changes made in this MR were replacing references to the deprecated ioutil module. I could not get tests for certain versions of Go passing without utilizing the v3 directory and splitting up the test job into two separate jobs. So in order to prevent breaking functionality for users of Go 1.14, 1.15, etc., I believe the need for the v3 directory and separate test jobs is necessary. If you have any suggestions to mitigate this issue in a different way, please let me know and I can accommodate.

Copy link

@marcoshuck marcoshuck Aug 9, 2023

Choose a reason for hiding this comment

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

That's a very a good point. We need to have this discussion with some of the members from the @sendgrid team, my 2c: We should replace ioutil with io package references or any other alternative that makes it work. Bumping to a new major version should allow us to deprecate previous Go versions.

Copy link
Author

Choose a reason for hiding this comment

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

@twilio-dx @SendGridDX Any suggested next steps?

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.

2 participants