Repository navigation
docs: add package-level examples (#236) - #254
Draft
PlaidSnowFrog wants to merge 8 commits into
Draft
PlaidSnowFrog wants to merge 8 commits into
PlaidSnowFrog wants to merge 8 commits into
Conversation
Signed-off-by: shreyaabaranwal <shreyabaranwal229@gmail.com>
Signed-off-by: shreyaabaranwal <shreyabaranwal229@gmail.com>
…itfield#236) Signed-off-by: shreyaabaranwal <shreyabaranwal229@gmail.com>
Move count_errors and filter_csv into Example_ functions, with their data files in testdata/, and remove the examples/ directory. Windows compatibility will follow in a later commit.
Replace os.Exit(1) error handling in Example_createWriteFile and other example functions with return, matching the pattern used by the other examples (e.g. ExamplePipe_String, ExamplePipe_CountLines).
Owner
|
Is this branch up to date with |
Author
|
I think the branch is up to date: it already contains everything on Sorry for the confusion. I'll also push a few fixes soon as I noticed there are still some things that need fixing (a stale README link and some others), plus the Windows example. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Continues #243 (keeping @shreyaabaranwal's commits). Closes #236.
Following the direction agreed in #243:
Example_functions inscript_test.go, with their data intestdata/.panic(err)withfmt.Fprintln(os.Stderr, err)followed byreturn, to match the existing examples in the file. (os.Exit(1)made sense for the standalone programs, but inside anExample_function it would stop the whole test run.)Example_listExecutablesExample_createWriteFilescript_unix_test.go. I'll add a Windows example inscript_windows_test.gobefore marking this ready.I'd like your opinion on two things:
(Listing [name](link))convention when the examples were separate files. Now that they'reExample_functions, should the README link to their pkg.go.dev anchors instead, or should I leave the README for a separate PR?Example_listExecutables) to match existing examples likeExampleIfExists_noExec, but your samples used snake_case (Example_count_lines). Happy to switch if you prefer.go test ./...,go vet ./...andGOOS=windows go vet ./...pass locally.