Golang io/ioutil.NopCloser() function example
package io/ioutil
Golang io/ioutil.NopCloser() function usage example
package main
import (
"bytes"
"io/ioutil"
)
func main() {
str := bytes.NewReader([]byte("abcdefghijklmnopqrstuvwxyz"))
reader := ioutil.NopCloser(str)
defer reader.Close() // now we can close the ReadCloser returned by NopCloser
}
Reference :
Advertisement
Something interesting
Tutorials
+7k Golang : Takes a plural word and makes it singular
+12.7k Golang : Sort and reverse sort a slice of bytes
+18k Golang : How to log each HTTP request to your web server?
+44.9k Golang : Use wildcard patterns with filepath.Glob() example
+6.5k Unix/Linux : How to get own IP address ?
+32.4k Golang : Math pow(the power of x^y) example
+11.9k Golang : Convert decimal number(integer) to IPv4 address
+16.9k Golang : Set up source IP address before making HTTP request
+9.1k Golang : io.Reader causing panic: runtime error: invalid memory address or nil pointer dereference
+7.4k Golang : Accessing dataframe-go element by row, column and name example
+6.2k Golang : Calculate US Dollar Index (DXY)
+6.8k Unix/Linux : How to fix CentOS yum duplicate glibc or device-mapper-libs dependency error?