[go] net/textproto: Add an example for textproto.Conn

410 views
Skip to first unread message

Gobot Gobot (Gerrit)

unread,
Dec 21, 2017, 4:42:07 PM12/21/17
to Owen Marshall, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

Congratulations on opening your first change. Thank you for your contribution!

Next steps:
Within the next week or so, a maintainer will review your change and provide
feedback. See https://golang.org/doc/contribute.html#review for more info and
tips to get your patch through code review.

Most changes in the Go project go through a few rounds of revision. This can be
surprising to people new to the project. The careful, iterative review process
is our way of helping mentor contributors and ensuring that their contributions
have a lasting impact.

During May-July and Nov-Jan the Go project is in a code freeze, during which
little code gets reviewed or merged. If a reviewer responds with a comment like
R=go1.11, it means that this CL will be reviewed as part of the next development
cycle. See https://golang.org/s/release for more details.

View Change

    To view, visit change 85195. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-MessageType: comment
    Gerrit-Change-Id: Id90caa55e9d04377923a8646b3476411969abe9f
    Gerrit-Change-Number: 85195
    Gerrit-PatchSet: 1
    Gerrit-Owner: Owen Marshall <o...@om.ht>
    Gerrit-CC: Gobot Gobot <go...@golang.org>
    Gerrit-Comment-Date: Thu, 21 Dec 2017 21:42:03 +0000
    Gerrit-HasComments: No
    Gerrit-HasLabels: No

    Owen Marshall (Gerrit)

    unread,
    Dec 21, 2017, 5:19:12 PM12/21/17
    to Ian Lance Taylor, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

    Owen Marshall has uploaded this change for review.

    View Change

    net/textproto: Add an example for textproto.Conn

    Add a simple connect/response client to net/textproto
    that connects to google.com, reads robots.txt, and
    prints the response until EOF.

    Change-Id: Id90caa55e9d04377923a8646b3476411969abe9f
    ---
    A src/net/textproto/example_test.go
    1 file changed, 37 insertions(+), 0 deletions(-)

    diff --git a/src/net/textproto/example_test.go b/src/net/textproto/example_test.go
    new file mode 100644
    index 0000000..1384268
    --- /dev/null
    +++ b/src/net/textproto/example_test.go
    @@ -0,0 +1,37 @@
    +// Copyright 2012 The Go Authors. All rights reserved.
    +// Use of this source code is governed by a BSD-style
    +// license that can be found in the LICENSE file.
    +
    +package textproto_test
    +
    +import (
    + "fmt"
    + "io"
    + "log"
    + "net/textproto"
    +)
    +
    +func ExampleConn() {
    + // Dial a remote server
    + conn, err := textproto.Dial("tcp", "google.com:80")
    + if err != nil {
    + log.Fatal(err)
    + }
    +
    + // Send a HTTP GET to the remote server
    + conn.PrintfLine("GET /robots.txt")
    +
    + for {
    + // Read lines until EOF
    + recv, err := conn.ReadLine()
    + if err == io.EOF {
    + break
    + }
    +
    + if err != nil {
    + log.Fatal(err)
    + }
    +
    + fmt.Println(recv)
    + }
    +}

    To view, visit change 85195. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-MessageType: newchange

    Owen Marshall (Gerrit)

    unread,
    Dec 21, 2017, 5:19:12 PM12/21/17
    to goph...@pubsubhelper.golang.org, Gobot Gobot, golang-co...@googlegroups.com

    Owen Marshall uploaded patch set #2 to this change.

    View Change

    net/textproto: Add an example for textproto.Conn

    Add a simple connect/response client to net/textproto
    that connects to google.com, reads robots.txt, and
    prints the response until EOF.

    Change-Id: Id90caa55e9d04377923a8646b3476411969abe9f
    ---
    A src/net/textproto/example_test.go
    1 file changed, 37 insertions(+), 0 deletions(-)

    To view, visit change 85195. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-MessageType: newpatchset
    Gerrit-Change-Id: Id90caa55e9d04377923a8646b3476411969abe9f
    Gerrit-Change-Number: 85195
    Gerrit-PatchSet: 2

    Owen Marshall (Gerrit)

    unread,
    Jan 12, 2018, 11:13:06 AM1/12/18
    to goph...@pubsubhelper.golang.org, Brad Fitzpatrick, Gobot Gobot, golang-co...@googlegroups.com

    added bradfitz as a reviewer (well, an assignee at first, sorry ;)) per https://golang.org/s/owners and GitHub #17555

    View Change

      To view, visit change 85195. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-MessageType: comment
      Gerrit-Change-Id: Id90caa55e9d04377923a8646b3476411969abe9f
      Gerrit-Change-Number: 85195
      Gerrit-PatchSet: 2
      Gerrit-Owner: Owen Marshall <o...@om.ht>
      Gerrit-Reviewer: Owen Marshall <o...@om.ht>
      Gerrit-CC: Brad Fitzpatrick <brad...@golang.org>
      Gerrit-CC: Gobot Gobot <go...@golang.org>
      Gerrit-Comment-Date: Fri, 12 Jan 2018 16:13:02 +0000
      Gerrit-HasComments: No
      Gerrit-HasLabels: No

      Brad Fitzpatrick (Gerrit)

      unread,
      Jan 12, 2018, 11:58:50 AM1/12/18
      to Owen Marshall, goph...@pubsubhelper.golang.org, Brad Fitzpatrick, Gobot Gobot, golang-co...@googlegroups.com

      R=go1.11

      Too late for Go 1.10, sorry (even in December). Somebody can review in February.

      View Change

        To view, visit change 85195. To unsubscribe, or for help writing mail filters, visit settings.

        Gerrit-Project: go
        Gerrit-Branch: master
        Gerrit-MessageType: comment
        Gerrit-Change-Id: Id90caa55e9d04377923a8646b3476411969abe9f
        Gerrit-Change-Number: 85195
        Gerrit-PatchSet: 2
        Gerrit-Owner: Owen Marshall <o...@om.ht>
        Gerrit-Reviewer: Owen Marshall <o...@om.ht>
        Gerrit-CC: Brad Fitzpatrick <brad...@golang.org>
        Gerrit-CC: Gobot Gobot <go...@golang.org>
        Gerrit-Comment-Date: Fri, 12 Jan 2018 16:58:47 +0000
        Gerrit-HasComments: No
        Gerrit-HasLabels: No

        Sean Liao (Gerrit)

        unread,
        Apr 13, 2025, 12:28:04 PM4/13/25
        to Owen Marshall, goph...@pubsubhelper.golang.org, Brad Fitzpatrick, Gopher Robot, golang-co...@googlegroups.com

        Sean Liao abandoned this change

        Related details

        Attention set is empty
        Submit Requirements:
        • requirement is not satisfiedCode-Review
        • requirement satisfiedNo-Unresolved-Comments
        • requirement is not satisfiedReview-Enforcement
        • requirement is not satisfiedTryBots-Pass
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: abandon
        Gerrit-Project: go
        Gerrit-Branch: master
        Gerrit-Change-Id: Id90caa55e9d04377923a8646b3476411969abe9f
        Gerrit-Change-Number: 85195
        Gerrit-PatchSet: 2
        Gerrit-Owner: Owen Marshall <o...@om.ht>
        Gerrit-Reviewer: Owen Marshall <o...@om.ht>
        Gerrit-CC: Brad Fitzpatrick <brad...@golang.org>
        Gerrit-CC: Gopher Robot <go...@golang.org>
        unsatisfied_requirement
        satisfied_requirement
        open
        diffy
        Reply all
        Reply to author
        Forward
        0 new messages