First I added an example for tar.Writer as well, but removed it in favor of ...
12 years, 1 month ago
(2013-01-26 17:05:19 UTC)
#4
First I added an example for tar.Writer as well, but removed it in favor of the
much more concise comment.
Pros:
* The concise example captures the important aspects without distractions.
Cons:
* It isn't checked for compile time errors since it's a comment.
For reader it makes sense to use a code example, since it will dual as a test
case.
Could we make a concise tar.Writer code example or should we stay with using the
comment example?
On Sun, Jan 27, 2013 at 1:05 AM, <r.eklind.87@gmail.com> wrote: > First I added an ...
12 years, 1 month ago
(2013-01-26 19:01:23 UTC)
#5
On Sun, Jan 27, 2013 at 1:05 AM, <r.eklind.87@gmail.com> wrote:
> First I added an example for tar.Writer as well, but removed it in favor
> of the much more concise comment.
>
> Pros:
> * The concise example captures the important aspects without
> distractions.
> Cons:
> * It isn't checked for compile time errors since it's a comment.
>
> For reader it makes sense to use a code example, since it will dual as a
> test case.
>
> Could we make a concise tar.Writer code example or should we stay with
> using the comment example?
>
my opinion is that if we can integrate the comments in the example comment
into the example code, we can get rid of the example comments.
https://codereview.appspot.com/7220048/diff/1002/src/pkg/archive/tar/example_test.go File src/pkg/archive/tar/example_test.go (right): https://codereview.appspot.com/7220048/diff/1002/src/pkg/archive/tar/example_test.go#newcode11 src/pkg/archive/tar/example_test.go:11: func ExampleReader() { We could make this example self-contained ...
12 years, 1 month ago
(2013-01-29 04:21:48 UTC)
#6
On Thursday, January 31, 2013, Andrew Gerrand wrote: > Actually I was thinking that we ...
12 years, 1 month ago
(2013-01-31 08:34:16 UTC)
#11
On Thursday, January 31, 2013, Andrew Gerrand wrote:
> Actually I was thinking that we should avoid relying on testdata/ files
> altogether, so that this can be run in the playground sandbox.
>
i imagine that when running locally with godoc -play,
we can start the compiled binary under the directory
for the current package, so that examples using
testdat could be run, what do you think?
On 2013/01/31 16:32:05, u wrote: > Hello mailto:golang-dev@googlegroups.com, mailto:minux.ma@gmail.com, mailto:adg@golang.org (cc: > mailto:golang-dev@googlegroups.com), > > ...
12 years, 1 month ago
(2013-01-31 16:33:39 UTC)
#13
On 2013/01/31 16:32:05, u wrote:
> Hello mailto:golang-dev@googlegroups.com, mailto:minux.ma@gmail.com,
mailto:adg@golang.org (cc:
> mailto:golang-dev@googlegroups.com),
>
> Please take another look.
I agree that it's nice if this code runs smoothly in the playground. The only
thing missing would be the example usage of tar.FileInfoHeader, which is quite
convenient when handling actual files.
I've updated the example code. Before the final commit, "hello world" could be
replaced with something more imaginative.
The examples are now more consistent with the zip examples. The zip example is split ...
12 years, 1 month ago
(2013-01-31 16:53:05 UTC)
#15
The examples are now more consistent with the zip examples.
The zip example is split into a reader and a writer. The reader uses testdata.
What is the preferred solution?
Issue 7220048: code review 7220048: archive/tar: Add reader and writer code example.
(Closed)
Created 12 years, 1 month ago by u
Modified 12 years ago
Reviewers: adg
Base URL:
Comments: 6