Skip to content

Instantly share code, notes, and snippets.

@amelhusic
Forked from crgimenes/stringToReaderCloser.go
Created November 19, 2020 13:24
Show Gist options
  • Select an option

  • Save amelhusic/56fca85dce24a1fdc48d0a329295c058 to your computer and use it in GitHub Desktop.

Select an option

Save amelhusic/56fca85dce24a1fdc48d0a329295c058 to your computer and use it in GitHub Desktop.

Revisions

  1. @crgimenes crgimenes revised this gist Jun 10, 2019. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions stringToReaderCloser.go
    Original file line number Diff line number Diff line change
    @@ -8,8 +8,8 @@ import (

    func main() {
    r := ioutil.NopCloser(bytes.NewReader([]byte("hello world"))) // r type is io.ReadCloser
    // example to test r
    // example to test r
    buf := new(bytes.Buffer)
    buf.ReadFrom(r)
    r.Close()
  2. @crgimenes crgimenes revised this gist Jun 10, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion stringToReaderCloser.go
    Original file line number Diff line number Diff line change
    @@ -9,7 +9,7 @@ import (
    func main() {
    r := ioutil.NopCloser(bytes.NewReader([]byte("hello world"))) // r type is io.ReadCloser

    // exemplo to test r
    // example to test r
    buf := new(bytes.Buffer)
    buf.ReadFrom(r)
    r.Close()
  3. @crgimenes crgimenes revised this gist Mar 24, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion stringToReaderCloser.go
    Original file line number Diff line number Diff line change
    @@ -7,7 +7,7 @@ import (
    )

    func main() {
    r := ioutil.NopCloser(bytes.NewReader([]byte("hello world"))) // r type is io.ReaderCloser
    r := ioutil.NopCloser(bytes.NewReader([]byte("hello world"))) // r type is io.ReadCloser

    // exemplo to test r
    buf := new(bytes.Buffer)
  4. @crgimenes crgimenes created this gist Feb 22, 2018.
    18 changes: 18 additions & 0 deletions stringToReaderCloser.go
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    package main

    import (
    "bytes"
    "fmt"
    "io/ioutil"
    )

    func main() {
    r := ioutil.NopCloser(bytes.NewReader([]byte("hello world"))) // r type is io.ReaderCloser

    // exemplo to test r
    buf := new(bytes.Buffer)
    buf.ReadFrom(r)
    r.Close()
    s := buf.String()
    fmt.Println(s)
    }