What you get for w
is a pointer to the non exported type http.response
but as ResponseWriter
is an interface, that’s not visible.
From server.go:
type ResponseWriter interface {
...
}
On the other hand, r
is a pointer to a concrete struct, hence the need to pass a reference explicitly.
From request.go:
type Request struct {
...
}
Related Contents:
- How can I compare pointers in Go?
- How do I do a literal *int64 in Go?
- Pointers vs. values in parameters and return values
- Hiding nil values, understanding why Go fails here
- X does not implement Y (… method has a pointer receiver)
- How to use global var across files in a package?
- ” is pointer to interface, not interface” confusion
- How can I store reference to the result of an operation in Go?
- My object is not updated even if I use the pointer to a type to update it
- How to get the pointer of return value from function call?
- Why should constructor of Go return address?
- Why does Go forbid taking the address of (&) map member, yet allows (&) slice element?
- Slicing a slice pointer passed as argument
- Can the pointer in a struct pointer method be reassigned to another instance?
- Using the extra 16 bits in 64-bit pointers
- Value receiver vs. pointer receiver
- Using Pointers in a for loop
- What is a “fat pointer”?
- Copying a struct containing pointers to CUDA device
- Why is the return type of Deref::deref itself a reference?
- Why does printing a pointer print the same thing as printing the dereferenced pointer?
- why slice values can sometimes go stale but never map values?
- How can I instantiate a non-nil pointer of type argument with generic Go?
- Should pointer comparisons be signed or unsigned in 64-bit x86?
- Return pointer to local struct
- Passing a 2D array to a C++ function
- Why use double indirection? or Why use pointers to pointers?
- Correct way of declaring pointer variables in C/C++ [closed]
- How to stop a goroutine
- How to initialize a nested struct?
- How can I allocate memory and return it (via a pointer-parameter) to the calling function?
- Post-increment on a dereferenced pointer?
- Modifying C string constants? [duplicate]
- Pointer Arithmetic In C
- Pointers, smart pointers or shared pointers? [duplicate]
- Modifying a const through a non-const pointer
- How many levels of pointers can we have?
- Converting multidimensional arrays to pointers in c++
- Iterate through the fields of a struct in Go
- Convert string to integer type in Go?
- What are the use(s) for struct tags in Go?
- Access struct property by name
- Function to dynamically allocate matrix
- What is the meaning of “dot parenthesis” syntax? [duplicate]
- Is it possible to partially decode and update JSON? (go)
- How to print variable addresses in C?
- Placement of the asterisk in Objective-C
- Cast pointer to member function to normal pointer
- How to properly seed random number generator
- Why can´t we assign a new string to an char array, but to a pointer?