From d2bc921f997425bc267d8e4845286b0d67bbe1ef Mon Sep 17 00:00:00 2001 From: Cody Oss <6331106+codyoss@users.noreply.github.com> Date: Tue, 8 Dec 2020 14:34:15 -0700 Subject: [PATCH] fix(compute): don't tigger linter for field named Deprecated (#774) Fixes: #767 --- compute/v1/compute-gen.go | 33 +++++++++++++++++---------------- google-api-go-generator/gen.go | 7 ++++++- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/compute/v1/compute-gen.go b/compute/v1/compute-gen.go index 534856c4807..b56389d9fb2 100644 --- a/compute/v1/compute-gen.go +++ b/compute/v1/compute-gen.go @@ -1107,8 +1107,8 @@ type AcceleratorType struct { // format. CreationTimestamp string `json:"creationTimestamp,omitempty"` - // Deprecated: [Output Only] The deprecation status associated with this - // accelerator type. + // Deprecated -- [Output Only] The deprecation status associated with + // this accelerator type. Deprecated *DeprecationStatus `json:"deprecated,omitempty"` // Description: [Output Only] An optional textual description of the @@ -6672,9 +6672,9 @@ type DeprecationStatus struct { // explicitly changes it. Deleted string `json:"deleted,omitempty"` - // Deprecated: An optional RFC3339 timestamp on or after which the state - // of this resource is intended to change to DEPRECATED. This is only - // informational and the status will not change unless the client + // Deprecated -- An optional RFC3339 timestamp on or after which the + // state of this resource is intended to change to DEPRECATED. This is + // only informational and the status will not change unless the client // explicitly changes it. Deprecated string `json:"deprecated,omitempty"` @@ -7454,8 +7454,8 @@ type DiskType struct { // GB. DefaultDiskSizeGb int64 `json:"defaultDiskSizeGb,omitempty,string"` - // Deprecated: [Output Only] The deprecation status associated with this - // disk type. + // Deprecated -- [Output Only] The deprecation status associated with + // this disk type. Deprecated *DeprecationStatus `json:"deprecated,omitempty"` // Description: [Output Only] An optional description of this resource. @@ -13229,7 +13229,7 @@ type Image struct { // format. CreationTimestamp string `json:"creationTimestamp,omitempty"` - // Deprecated: The deprecation status associated with this image. + // Deprecated -- The deprecation status associated with this image. Deprecated *DeprecationStatus `json:"deprecated,omitempty"` // Description: An optional description of this resource. Provide this @@ -20261,8 +20261,9 @@ type MachineType struct { // format. CreationTimestamp string `json:"creationTimestamp,omitempty"` - // Deprecated: [Output Only] The deprecation status associated with this - // machine type. Only applicable if the machine type is unavailable. + // Deprecated -- [Output Only] The deprecation status associated with + // this machine type. Only applicable if the machine type is + // unavailable. Deprecated *DeprecationStatus `json:"deprecated,omitempty"` // Description: [Output Only] An optional textual description of the @@ -24503,8 +24504,8 @@ type NodeType struct { // format. CreationTimestamp string `json:"creationTimestamp,omitempty"` - // Deprecated: [Output Only] The deprecation status associated with this - // node type. + // Deprecated -- [Output Only] The deprecation status associated with + // this node type. Deprecated *DeprecationStatus `json:"deprecated,omitempty"` // Description: [Output Only] An optional textual description of the @@ -27897,8 +27898,8 @@ type Region struct { // format. CreationTimestamp string `json:"creationTimestamp,omitempty"` - // Deprecated: [Output Only] The deprecation status associated with this - // region. + // Deprecated -- [Output Only] The deprecation status associated with + // this region. Deprecated *DeprecationStatus `json:"deprecated,omitempty"` // Description: [Output Only] Textual description of the resource. @@ -43558,8 +43559,8 @@ type Zone struct { // format. CreationTimestamp string `json:"creationTimestamp,omitempty"` - // Deprecated: [Output Only] The deprecation status associated with this - // zone. + // Deprecated -- [Output Only] The deprecation status associated with + // this zone. Deprecated *DeprecationStatus `json:"deprecated,omitempty"` // Description: [Output Only] Textual description of the resource. diff --git a/google-api-go-generator/gen.go b/google-api-go-generator/gen.go index e934f836122..e19e2730863 100644 --- a/google-api-go-generator/gen.go +++ b/google-api-go-generator/gen.go @@ -1381,7 +1381,12 @@ func (s *Schema) writeSchemaStruct(api *API) { p.assignedGoName = pname des := p.Description() if des != "" { - s.api.p("%s", asComment("\t", fmt.Sprintf("%s: %s", pname, des))) + if pname == "Deprecated" { + // Workaround to not trip up linters on fields named Deprecated. + s.api.p("%s", asComment("\t", fmt.Sprintf("%s -- %s", pname, des))) + } else { + s.api.p("%s", asComment("\t", fmt.Sprintf("%s: %s", pname, des))) + } } addFieldValueComments(s.api.p, p, "\t", des != "")