-
Notifications
You must be signed in to change notification settings - Fork 165
Description
API Linter v2.0.0
API Linter v2.0.0 is a work in progress. This issue is intended as both an announcement and a single point of communication for the development of the new major version.
The new major version modernizes the linter's core foundation and aligns it with the future of Protobuf Go. It moves the entire codebase from the github.com/jhump/protoreflect module to the google.golang.org/protobuf module.
✨ What's New in 2.0.0?
- Modern
protoreflectBackend: The linter now uses the official Go Protobuf reflection library, ensuring better stability and long-term compatibility with the Go ecosystem. - Future-Proof Architecture: By aligning with
google.golang.org/protobuf, we ensure the API Linter remains robust and compatible with future Protobuf advancements.
Release Plan
This new version is a new Go module github.com/googleapis/api-linter/v2. As part of our release process, we are going to make several pre-releases, to ensure the stability of the final version. Release candidates will be available for testing in our releases section, and will be tagged as release candidates using semantic versioning v2.0.0-beta.x.
⚠️ Breaking Changes
This release introduces a breaking change that only affects users who are using the lint and the locations packages. If you only use the api-linter CLI, these changes won’t affect you.
The core change is that descriptor types used in function signatures have changed to their corresponding google.golang.org/protobuf counterparts.
What does this look like?
- import "github.com/jhump/protoreflect/desc"
+ import "google.golang.org/protobuf/reflect/protoreflect"
var myRule = &lint.MessageRule{
- LintMessage: func(d *desc.MessageDescriptor) []lint.Problem {
- if len(d.GetFields()) == 0 { /* ... */ }
+ LintMessage: func(d protoreflect.MessageDescriptor) []lint.Problem {
+ if d.Fields().Len() == 0 { /* ... */ }
return nil
},
}
The migration is straightforward and consists of updating imports, type signatures, and method calls.
How to Try it out
To try out the new api-linter, use one of the following installation methods:
- Use go install
go install github.com/googleapis/api-linter/v2/cmd/[email protected]-
Download the binary from our releases page
-
Build the binary from source
git clone [email protected]:googleapis/api-linter.git \
git fetch origin ref/tags/v2.0.0-beta.2 && git checkout v2.0.0-beta.2 \
go build cmd/api_linter -o api-linterv2.0.0-beta.2How to report a Bug?
To file a bug report create a new bug, indicate the version in use is a release candidate v2.0.0-beta.2 (we will add a v2 label), and reference this issue as the parent issue to help us keep track of things.