I'm currently studying Go and trying to understand the concept of Interfaces. What I understand about it is that whatever type implements the functions specified in the interface is part of it. My question is about the Body of type io.ReadCloser inside of the Response struct. How does it implement the Read function? I've searched through the documentation and couldn't find it.
How does resp.Body implements the Read function?
61 views Asked by Rodrigo Felipe At
1
There are 1 answers
Related Questions in GO
- Go Fiber and HTMX - HX-Trigger header is changed to Hx-Trigger, which is not what HTMX is listening for
- Golang == Error: OCI runtime create failed: unable to start container process: exec: "./bin": stat ./bin: no such file or directory: unknown
- Handling both JSON and form values in POST request body with unknown values in Golang
- invalid transaction: Transaction failed to sanitize accounts offsets correctly
- Golang lambda upload image into s3 static website
- Is there a way to get a list of selected module versions, but only for modules within the pruned graph?
- Save Interface in DB golang
- ERROR: column "country" is of type text[] but expression is of type record (SQLSTATE 42804)
- Trying to update the version.go file with the release tag from GitHub actions but its failing
- How can I optimize this transposition table for connect 4 AI?
- const declaration - How to evaluate expressions at compile time?
- How add array of authors for unique user in database in Goland IDE?
- Why is the main goroutine not blocked after write in unbuffered channel?
- Insert & Retrieve from a channel in same main function throws "goroutine 1 [chan receive]: main.main() /path exit status 2" error
- Gob error when decoding array of structs: decoding into local type but received remote type
Related Questions in INTERFACE
- How do I apply the interface concept with the base-class in design?
- Save Interface in DB golang
- Collections.max with custom Comparator on list
- Linux Networking - Routing packets from one network interface to another
- How to design the file operation interface involving status and transactions?
- Angular component's interface ( @Output / @Input ) how do you expose methods? Or certain type of events?
- Own Pattern / framework for interfacing with components in C
- Does anyone know how to make iPad layout the same as iPhone's? Size wise the text and overall layout get's smaller when I run the app on the iPad
- Use Interface Type in Map or Struct Definition, but Implement with Concrete utype
- How does variance work when implementing interfaces/type aliases in TypeScript?
- Fatal error: Uncaught TypeError when returning class instead of interface
- Golang Use of array of structs that implement MyInterface as []MyInterface not allowed
- Calling c++ from fortran
- Interface and model in TypeScript (angular 17)
- Interface called Delegate call failed
Related Questions in GO-INTERFACE
- Wrong implementation of nested interfaces in Golang
- How does the type interface work with GORM?
- Implementing grpc in gnark v0.8.1, how to convert Proof, Verification Key & Public Witness to go-native type?
- Appending to slice in map which is type of map[any]any
- `gopls` disagrees with `go test` on interface implementation
- Calling functions with unknown number of arguments
- In golang how to loop through string interface
- In Golang, how can a consumer define an interface for a function that accepts an interface?
- How can I reach struct member in interface type
- How does resp.Body implements the Read function?
- Go - Pass callback function to child (imported) package
- Go append a string to an array of array of interface
- Go interface using `var` keyword?
- Golang compare and update keys from two different map string interfaces
- Golang map with any key type and any value type
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Popular Tags
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
io.ReadCloserdoes not implement theReadfunction.io.ReadCloseris an interface type, so it by itself cannot implement any methods. However, an interfaceTcan implement another interfaceIifT's type set is a subset ofI.The
io.ReadCloserinterface embeds theio.Readerandio.Closerinterfaces. Therefore the method set ofio.ReadeCloseris the combined method set ofio.Readerandio.Closer.Thanks to embedding the type set of
io.ReadCloseris the intersection ofio.Reader's andio.Closer's type sets. In other words the type set ofio.ReadCloseris the set of all types that implement theio.Readerandio.Closerinterfaces.The above also means that the type set of
io.ReadCloseris a subset ofio.Reader's type set andio.Closer's type set.The
io.ReadCloserinterface implementsio.Readerbecause: