internal/api/types.go: fix comments Move end-of-line comments to above the field. Change-Id: I558e43571d84bee9667902bd9cc45abde3d88f93 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/803140 kokoro-CI: kokoro <noreply+kokoro@google.com> LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Ethan Lee <ethanalee@google.com>
diff --git a/cmd/internal/pkgsite-cli/client/types_gen.go b/cmd/internal/pkgsite-cli/client/types_gen.go index e963e3a..63baace 100644 --- a/cmd/internal/pkgsite-cli/client/types_gen.go +++ b/cmd/internal/pkgsite-cli/client/types_gen.go
@@ -25,10 +25,11 @@ } type PackageInfo struct { - Path string `json:"path"` - Name string `json:"name"` - Synopsis string `json:"synopsis"` - IsRedistributable bool `json:"isRedistributable"` // Whether the license allows distribution. + Path string `json:"path"` + Name string `json:"name"` + Synopsis string `json:"synopsis"` + // IsRedistributable is whether the license allows distribution. + IsRedistributable bool `json:"isRedistributable"` } type PackagesResponse struct { @@ -61,16 +62,19 @@ // ModuleVersion is the response for /v1beta/versions/{path}. type ModuleVersion struct { - ModulePath string `json:"modulePath"` - Version string `json:"version"` - CommitTime time.Time `json:"commitTime"` - IsRedistributable bool `json:"isRedistributable"` // Whether the license allows distribution. - HasGoMod bool `json:"hasGoMod"` // Whether the module has a go.mod file. - LatestVersion string `json:"latestVersion"` // latest unretracted version - Deprecated bool `json:"deprecated"` - DeprecationReason string `json:"deprecationReason"` - Retracted bool `json:"retracted"` - RetractionReason string `json:"retractionReason"` + ModulePath string `json:"modulePath"` + Version string `json:"version"` + CommitTime time.Time `json:"commitTime"` + // IsRedistributable is whether the license allows distribution. + IsRedistributable bool `json:"isRedistributable"` + // HasGoMod is whether the module has a go.mod file. + HasGoMod bool `json:"hasGoMod"` + // LatestVersion is the latest unretracted version. + LatestVersion string `json:"latestVersion"` + Deprecated bool `json:"deprecated"` + DeprecationReason string `json:"deprecationReason"` + Retracted bool `json:"retracted"` + RetractionReason string `json:"retractionReason"` } // Module is the response for /v1beta/module/{modulePath}. @@ -129,12 +133,15 @@ // Error contains detailed information about an error. type Error struct { - Code int `json:"code"` // HTTP status code - Message string `json:"message"` - Fixes []string `json:"fixes"` // suggestions for how to fix + // Code is the HTTP status code. + Code int `json:"code"` + Message string `json:"message"` + // Fixes are suggestions for how to fix. + Fixes []string `json:"fixes"` Candidates []Candidate `json:"candidates,omitempty"` - err error // Unexported field for internal tracking + // err is an unexported field for internal tracking. + err error } // A Candidate is a potential resolution for an ambiguous path.
diff --git a/internal/api/openapi.yaml b/internal/api/openapi.yaml index 292efd2..813229d 100644 --- a/internal/api/openapi.yaml +++ b/internal/api/openapi.yaml
@@ -728,11 +728,11 @@ "type": "array" }, "code": { - "description": "HTTP status code", + "description": "Code is the HTTP status code.", "type": "integer" }, "fixes": { - "description": "suggestions for how to fix", + "description": "Fixes are suggestions for how to fix.", "items": { "type": "string" }, @@ -817,15 +817,15 @@ "type": "string" }, "hasGoMod": { - "description": "Whether the module has a go.mod file.", + "description": "HasGoMod is whether the module has a go.mod file.", "type": "boolean" }, "isRedistributable": { - "description": "Whether the license allows distribution.", + "description": "IsRedistributable is whether the license allows distribution.", "type": "boolean" }, "latestVersion": { - "description": "latest unretracted version", + "description": "LatestVersion is the latest unretracted version.", "type": "string" }, "modulePath": { @@ -864,7 +864,7 @@ "type": "boolean" }, "isRedistributable": { - "description": "Whether the license allows distribution.", + "description": "IsRedistributable is whether the license allows distribution.", "type": "boolean" }, "isStandardLibrary": { @@ -911,7 +911,7 @@ "PackageInfo": { "properties": { "isRedistributable": { - "description": "Whether the license allows distribution.", + "description": "IsRedistributable is whether the license allows distribution.", "type": "boolean" }, "name": {
diff --git a/internal/api/types.go b/internal/api/types.go index 5d4ae9a..eee5f05 100644 --- a/internal/api/types.go +++ b/internal/api/types.go
@@ -26,10 +26,11 @@ } type PackageInfo struct { - Path string `json:"path"` - Name string `json:"name"` - Synopsis string `json:"synopsis"` - IsRedistributable bool `json:"isRedistributable"` // Whether the license allows distribution. + Path string `json:"path"` + Name string `json:"name"` + Synopsis string `json:"synopsis"` + // IsRedistributable is whether the license allows distribution. + IsRedistributable bool `json:"isRedistributable"` } type PackagesResponse struct { @@ -62,16 +63,19 @@ // ModuleVersion is the response for /v1beta/versions/{path}. type ModuleVersion struct { - ModulePath string `json:"modulePath"` - Version string `json:"version"` - CommitTime time.Time `json:"commitTime"` - IsRedistributable bool `json:"isRedistributable"` // Whether the license allows distribution. - HasGoMod bool `json:"hasGoMod"` // Whether the module has a go.mod file. - LatestVersion string `json:"latestVersion"` // latest unretracted version - Deprecated bool `json:"deprecated"` - DeprecationReason string `json:"deprecationReason"` - Retracted bool `json:"retracted"` - RetractionReason string `json:"retractionReason"` + ModulePath string `json:"modulePath"` + Version string `json:"version"` + CommitTime time.Time `json:"commitTime"` + // IsRedistributable is whether the license allows distribution. + IsRedistributable bool `json:"isRedistributable"` + // HasGoMod is whether the module has a go.mod file. + HasGoMod bool `json:"hasGoMod"` + // LatestVersion is the latest unretracted version. + LatestVersion string `json:"latestVersion"` + Deprecated bool `json:"deprecated"` + DeprecationReason string `json:"deprecationReason"` + Retracted bool `json:"retracted"` + RetractionReason string `json:"retractionReason"` } // Module is the response for /v1beta/module/{modulePath}. @@ -130,12 +134,15 @@ // Error contains detailed information about an error. type Error struct { - Code int `json:"code"` // HTTP status code - Message string `json:"message"` - Fixes []string `json:"fixes"` // suggestions for how to fix + // Code is the HTTP status code. + Code int `json:"code"` + Message string `json:"message"` + // Fixes are suggestions for how to fix. + Fixes []string `json:"fixes"` Candidates []Candidate `json:"candidates,omitempty"` - err error // Unexported field for internal tracking + // err is an unexported field for internal tracking. + err error } func (e *Error) Error() string {