Skip to content

Commit

Permalink
fix(compute): don't tigger linter for field named Deprecated (#774)
Browse files Browse the repository at this point in the history
Fixes: #767
  • Loading branch information
codyoss committed Dec 8, 2020
1 parent 7034dd7 commit d2bc921
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 17 deletions.
33 changes: 17 additions & 16 deletions compute/v1/compute-gen.go
Expand Up @@ -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
Expand Down Expand Up @@ -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"`

Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
7 changes: 6 additions & 1 deletion google-api-go-generator/gen.go
Expand Up @@ -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 != "")

Expand Down

0 comments on commit d2bc921

Please sign in to comment.