FAQ
Reviewers: golang-dev_googlegroups.com,

Message:
Hello golang-dev@googlegroups.com (cc: golang-dev@googlegroups.com),

I'd like you to review this change to
https://go.googlecode.com/hg/


Description:
crypto/cipher: add examples

Fixes issue 1390.

Please review this at http://codereview.appspot.com/6631044/

Affected files:
A src/pkg/crypto/cipher/example_test.go

Search Discussions

  • Minux Ma at Oct 8, 2012 at 7:38 pm
    https://codereview.appspot.com/6631044/diff/1002/src/pkg/crypto/cipher/example_test.go
    File src/pkg/crypto/cipher/example_test.go (right):

    https://codereview.appspot.com/6631044/diff/1002/src/pkg/crypto/cipher/example_test.go#newcode16
    src/pkg/crypto/cipher/example_test.go:16: func
    ExampleNewCBCDecrypter(key, ciphertext []byte) ([]byte, error) {
    example functions can't take arguments.

    https://codereview.appspot.com/6631044/
  • Agl at Oct 8, 2012 at 8:36 pm
    https://codereview.appspot.com/6631044/diff/1002/src/pkg/crypto/cipher/example_test.go
    File src/pkg/crypto/cipher/example_test.go (right):

    https://codereview.appspot.com/6631044/diff/1002/src/pkg/crypto/cipher/example_test.go#newcode16
    src/pkg/crypto/cipher/example_test.go:16: func
    ExampleNewCBCDecrypter(key, ciphertext []byte) ([]byte, error) {
    On 2012/10/08 19:38:12, minux wrote:
    example functions can't take arguments.
    Although the arguments don't appear in the example, I think it's clearer
    here to have a free variable called `key', than to fluff around with
    reading a random key and distract from the subject of the example.

    https://codereview.appspot.com/6631044/
  • Adg at Oct 12, 2012 at 1:41 am
    https://codereview.appspot.com/6631044/diff/1002/src/pkg/crypto/cipher/example_test.go
    File src/pkg/crypto/cipher/example_test.go (right):

    https://codereview.appspot.com/6631044/diff/1002/src/pkg/crypto/cipher/example_test.go#newcode16
    src/pkg/crypto/cipher/example_test.go:16: func
    ExampleNewCBCDecrypter(key, ciphertext []byte) ([]byte, error) {
    On 2012/10/08 19:42:23, agl1 wrote:
    On 2012/10/08 19:38:12, minux wrote:
    example functions can't take arguments.
    Although the arguments don't appear in the example, I think it's
    clearer here to
    have a free variable called `key', than to fluff around with reading a random
    key and distract from the subject of the example.
    If you have actual key, ciphertext, and plaintext globals then you can
    actually make these examples executable by including an Output: comment
    at the end of the function.

    As they are, the user doesn't see the functions signature so the return
    statements are a non-sequitur.

    https://codereview.appspot.com/6631044/
  • Agl at Oct 17, 2012 at 11:21 pm

    On 2012/10/12 01:41:55, adg wrote:
    If you have actual key, ciphertext, and plaintext globals then you can actually
    make these examples executable by including an Output: comment at the
    end of the
    function.
    Ok. Nobody likes the arguments to example functions it seems.

    Have removed that and added // Output comments in the case where it's
    possible. (Several the examples generate random outputs. I could make
    them deterministic, but at the cost of clarity in the example because
    you would actually want them to be random in real life.)


    https://codereview.appspot.com/6631044/
  • Agl at Oct 31, 2012 at 8:43 pm
    *** Submitted as
    http://code.google.com/p/go/source/detail?r=5f67048f835c ***

    crypto/cipher: add examples

    Fixes issue 1390.

    R=golang-dev, minux.ma, adg, agl
    CC=golang-dev
    http://codereview.appspot.com/6631044


    http://codereview.appspot.com/6631044/

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-dev @
categoriesgo
postedOct 8, '12 at 7:36p
activeOct 31, '12 at 8:43p
posts6
users4
websitegolang.org

4 users in discussion

Agl: 3 posts Agl: 1 post Minux Ma: 1 post Adg: 1 post

People

Translate

site design / logo © 2022 Grokbase