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

Convert to package, JSON null funcs to generics #16973

Merged

Conversation

jhendrixMSFT
Copy link
Member

@jhendrixMSFT jhendrixMSFT commented Feb 3, 2022

NullValue now takes a generic type parameter instead of an interface arg
to determine the type of null sentinel value to create.
IsNullValue infers its generic parameter to determine the type of null
sentinel value to look for.
At present, there is no way to express a 'nillable' generic type
constraint so the funcs simply take a [T any] which should be fine as
they typically take/return pointer-to-types.
The 'to' package has been reduced to two funcs.

  • The purpose of this PR is explained in this or a referenced issue.
  • The PR does not update generated files.
  • Tests are included and/or updated for code changes.
  • Updates to CHANGELOG.md are included.
  • MIT license headers are included in each file.

sdk/azcore/core.go Outdated Show resolved Hide resolved
@jhendrixMSFT jhendrixMSFT force-pushed the azcore_generic_to branch 2 times, most recently from b15b8a4 to bbfa21c Compare February 4, 2022 00:59
@check-enforcer
Copy link

check-enforcer bot commented Feb 4, 2022

This pull request is protected by Check Enforcer.

What is Check Enforcer?

Check Enforcer helps ensure all pull requests are covered by at least one check-run (typically an Azure Pipeline). When all check-runs associated with this pull request pass then Check Enforcer itself will pass.

Why am I getting this message?

You are getting this message because Check Enforcer did not detect any check-runs being associated with this pull request within five minutes. This may indicate that your pull request is not covered by any pipelines and so Check Enforcer is correctly blocking the pull request being merged.

What should I do now?

If the check-enforcer check-run is not passing and all other check-runs associated with this PR are passing (excluding license-cla) then you could try telling Check Enforcer to evaluate your pull request again. You can do this by adding a comment to this pull request as follows:
/check-enforcer evaluate
Typically evaulation only takes a few seconds. If you know that your pull request is not covered by a pipeline and this is expected you can override Check Enforcer using the following command:
/check-enforcer override
Note that using the override command triggers alerts so that follow-up investigations can occur (PRs still need to be approved as normal).

What if I am onboarding a new service?

Often, new services do not have validation pipelines associated with them. In order to bootstrap pipelines for a new service, please perform following steps:

For track 2 SDKs Issue the following command as a pull request comment:

/azp run prepare-pipelines
This will run a pipeline that analyzes the source tree and creates the pipelines necessary to build and validate your pull request. Once the pipeline has been created you can trigger the pipeline using the following comment:
/azp run go - [service] - ci

Copy link
Member

@seankane-msft seankane-msft left a comment

Choose a reason for hiding this comment

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

So much reduced code 😄

NullValue now takes a generic type parameter instead of an interface arg
to determine the type of null sentinel value to create.
IsNullValue infers its generic parameter to determine the type of null
sentinel value to look for.
At present, there is no way to express a 'nillable' generic type
constraint so the funcs simply take a [T any] which should be fine as
they typically take/return pointer-to-types.
The 'to' package has been reduced to two funcs.
@jhendrixMSFT jhendrixMSFT merged commit 072a1b3 into Azure:feature/generics Feb 4, 2022
@jhendrixMSFT jhendrixMSFT deleted the azcore_generic_to branch February 4, 2022 16:52
jhendrixMSFT added a commit that referenced this pull request Mar 15, 2022
NullValue now takes a generic type parameter instead of an interface arg
to determine the type of null sentinel value to create.
IsNullValue infers its generic parameter to determine the type of null
sentinel value to look for.
At present, there is no way to express a 'nillable' generic type
constraint so the funcs simply take a [T any] which should be fine as
they typically take/return pointer-to-types.
The 'to' package has been reduced to two funcs.
jhendrixMSFT added a commit that referenced this pull request Mar 25, 2022
NullValue now takes a generic type parameter instead of an interface arg
to determine the type of null sentinel value to create.
IsNullValue infers its generic parameter to determine the type of null
sentinel value to look for.
At present, there is no way to express a 'nillable' generic type
constraint so the funcs simply take a [T any] which should be fine as
they typically take/return pointer-to-types.
The 'to' package has been reduced to two funcs.
jhendrixMSFT added a commit that referenced this pull request Mar 29, 2022
* Update CI to use Go 1.18beta.2 (#16963)

* Update CI to use Go 1.18beta.2

* add prerelease install template

revert some unneeded changes

* fix parameters references

* fix curl

* use archive names

* fix param

* update linter

* build linters from source, display Go version

* lint clean

* fix smoke test version detection

* Update build constraints to Go 1.18 (#16966)

Specify 1.18 in go.mod file.

* Disable linter for now (#16975)

* Disable linter for now

Blows up on generic type parameters so disabling until it's working.
Restored installation to its original form.

* skip on linter install failure

* Convert to package, JSON null funcs to generics (#16973)

NullValue now takes a generic type parameter instead of an interface arg
to determine the type of null sentinel value to create.
IsNullValue infers its generic parameter to determine the type of null
sentinel value to look for.
At present, there is no way to express a 'nillable' generic type
constraint so the funcs simply take a [T any] which should be fine as
they typically take/return pointer-to-types.
The 'to' package has been reduced to two funcs.

* Disable publishing test results for now (#16979)

* Disable publishing test results for now

It's broken due to lack of generics support.  Test failures will still
block CI though.

* revert fake failure

* exclude track 2 from track 1 Format Check CI step

* refine track 1 gofmt check

* Migrate expiring resource to generics (#16974)

* Add generic pager implementation (#17027)

* Add generic pager implementation

* refine first page flag and processor vars

* refine per feedback, start adding tests

* fix LRO case, add remaining tests

* more consolidation

* update changelog

* remove page param, use unmarshal instead

* Add generic poller implementation (#17297)

Due to lack of support for type aliasing a generic type, we have
duplicate definitions for ARM and data-plane.  We can consolidate the
definitions when type aliasing support is added in the future.

* Clean-up in prep for merging feature/generics to main (#17380)

* Clean-up in prep for merging feature/generics to main

Removed some temporary CI changes after rebasing on main.
Added missing entries to the changelog.
Bumped version to v0.23.0 for breaking changes.

* bump golangci-lint to latest version

* switch to temporary fork of gocov
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