Skip to content
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

text/scanner: add examples #23768

Closed
awoodbeck opened this issue Feb 10, 2018 · 6 comments
Closed

text/scanner: add examples #23768

awoodbeck opened this issue Feb 10, 2018 · 6 comments

Comments

@awoodbeck
Copy link
Contributor

I recently worked with the text/scanner package and, although the documentation was straight forward, it could stand to use more examples.

I've been looking for opportunities to contribute to Go and I wouldn't mind working on improving the examples of the text/scanner package. I would like to add examples detailing the use of white space modifiers and tokens, as well as the various scanner and position methods. I would keep each example succinct, of course.

Are there particular guidelines to follow when it comes to examples?

@ALTree
Copy link
Member

ALTree commented Feb 10, 2018

  • for package-level examples, I would go with high-level, broad, well commented examples that show how to use the text/scanner package to accomplish something. Like the ones you can see for the sort package under the Overview section here: https://golang.org/pkg/sort/

  • for function-level examples, I would go with small, ideally auto-contained snippets that show how to setup and call the function. I suggest don't bothering to do this for functions that are extremely easy to use. An example that shows how to call a math function that take one argument, like this sq := math.Sqrt(x) is not useful.

You don't have to do both. For example, if you find that the text/scanner package would mostly benefit from just package-level examples, just add package-level examples.

@ALTree ALTree changed the title text/scanner: Add scanner examples text/scanner: add examples Feb 10, 2018
@awoodbeck
Copy link
Contributor Author

Is it most appropriate to post examples here for discussion before opening a CL?

@andybons
Copy link
Member

You should just open a CL.

Generally we ask that people don’t send code reviews until it’s agreed upon that a proposal should be implemented (adding a new package, changing something non-trivial). For documentation changes like adding examples, it’s reasonable to simply send out the code review and have a discussion there.

@gopherbot
Copy link

Change https://golang.org/cl/93199 mentions this issue: text/scanner: add examples

@awoodbeck
Copy link
Contributor Author

Is there anything I can do to facilitate a review of my CL? I'm new to the Golang CL process and don't know really what to expect.

@ALTree
Copy link
Member

ALTree commented Mar 9, 2018

According to the owners file, Robert owns the text/scanner package. Add him (gri@golang.org) as a reviewer in the CL on gerrit using the ADD REVIEWER button.

@golang golang locked and limited conversation to collaborators Mar 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants