-
Notifications
You must be signed in to change notification settings - Fork 1.8k
added import comments #654
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
Closed
daniel-sanche
wants to merge
1
commit into
GoogleCloudPlatform:master
from
daniel-sanche:kms_import_comments
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
These lines are a little bit weird since they don't list every import, only some of them. Would you mind splitting all of these functions into separate files and include the
import()block in the region tag? I think that's the pattern the canonical snippet will follow, so it would be a step in the right direction.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've had conversations with Kurtis (GoogleCloudPlatform/java-docs-samples#1218) and the product team (b/113025156) on how best to handle this. We decided that until we have an agreed upon standard way of handling imports, it would be best to leave the imports in the comments for now. This gives the users the information they need, and it's easy to be consistent with how we present the information across all supported languages without significant refactors.
As for not including all imports, I assumed standard imports like fmt, errors, and context would be considered a given for anyone familiar with go, but I can add them if you think it would be useful
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'm not sure. These are all standard library imports. So,
goimportsshould find them. So, I'm not sure this is worth adding.If we decide on the right way to include imports in the canonical snippet, we can update this.
Does that make sense?
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 suppose. I'd prefer to include these for consistency sake since these comments are needed for python and java. Even in go it might not be clear whether we're using standard crypto libraries or 3rd party ones with similar names, so I'd prefer to be explicit. But I guess these aren't as necessary for go
I am going to want to remove the region tags from the import block though, so this PR should stay open either way