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
create consistency around godoc parsing #331
Conversation
03e2e14
to
9ff2a5d
Compare
type SentinelMocksPermissionType string | ||
|
||
// WorkspaceLockingPermissionType represents the permissiontype to lock or unlock a workspace. | ||
type WorkspaceLockingPermissionType bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I deleted this type WorkspaceLockingPermissionType. It was not being used anywhere
bbba200
to
c5c0205
Compare
c5c0205
to
bae2150
Compare
@@ -15,7 +15,7 @@ var _ Plans = (*plans)(nil) | |||
// Plans describes all the plan related methods that the Terraform Enterprise | |||
// API supports. | |||
// | |||
// TFE API docs: https://www.terraform.io/docs/cloud/api/plan.html | |||
// TFE API docs: https://www.terraform.io/cloud-docs/api-docs/plans |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI, this is not suppose to be plans.html
. This would take you to a "page not found"
bae2150
to
5dc34ca
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👇
admin_organization.go
Outdated
// Any organizations with a name or notification email partially matching this value will be returned. | ||
Query string `url:"q,omitempty"` | ||
|
||
// Optional: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Include is an interesting and useful parameter that I think we should take better care to document explicitly. Here's an example from WorkspaceReadOptions:
// Optional: A list of relations to include. See available resources https://www.terraform.io/docs/cloud/api/workspaces.html#available-related-resources
I think we have good docs around which relations are possible to include, and a link would reinforce the relationship we now have to maintain because they are typed strings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
☝️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have a similar comment for the include options in admin_organization.go. You may have not seen it because is in line 75:
// A list of relations to include. See available resources
// https://www.terraform.io/docs/cloud/api/admin/organizations.html#available-related-resources
type AdminOrgIncludeOps string
So, the issue here is that we have discrepancy where we place that comment and link. Most of the time we do it on top of the type and occasionally we do it at the include field definition level, like what you see in workspace.go. I personally like it a bit more on top of the type declaration because Godoc makes types more visible and will include the typed constants for the include field.
admin_organization.go
Outdated
@@ -117,6 +117,7 @@ func (s *adminOrganizations) List(ctx context.Context, options *AdminOrganizatio | |||
return orgl, nil | |||
} | |||
|
|||
// List specific organizations in the Terraform Enterprise installation that have permission to use an organization's modules. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the godoc convention is to begin the comment with the element it describes:
"ListModuleConsumers lists specific organizations..."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👆 I noticed there were several comments for functions that don't follow the pattern: // <FUNCTION> does X and Y
-- something to keep an eye out for.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have not ran into that issue before, but I will keep an eye on that.
47eccc9
to
b6e52e5
Compare
admin_setting_twilio.go
Outdated
@@ -7,7 +7,7 @@ import ( | |||
// Compile-time proof of interface implementation. | |||
var _ TwilioSettings = (*adminTwilioSettings)(nil) | |||
|
|||
// TwilioSettings describes all the Twilio admin settings. | |||
// TwilioSettings describes all the Twilio admin settings for the Admin Setting API https://www.terraform.io/cloud-docs/api-docs/admin/settings. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I'm curious if we should move the link to a new line for readability.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do.
6cc8a5e
to
eb88cd1
Compare
eb88cd1
to
5b6e0f6
Compare
Description
The goal for this PR is to get the godocs ready for 1.0
There's a bit of inconsistency with the docs, where certain patterns are used for some resources and others deviate from the pattern. To mention a few:
Implementation and rules:
More rules around GoDoc can be found here: https://go.dev/blog/godoc
And their source code can be found here: https://github.com/golang/tools/tree/master/godoc
You can also see how their own source code gets parsed here https://pkg.go.dev/golang.org/x/tools@v0.1.9/godoc
must be sitting next to the declaration of the type like this:
That way GoDoc can document the type and the constants available to this type as a single group. If they are not sitting next to each other, for example in this case:
Then GoDoc will not make the connection between those two and will documented them separately.
Testing plan
These changes were tested by installing godoc locally and running
godoc -http=:6060
External links
Output from tests (HashiCorp employees only)