> ## Documentation Index
> Fetch the complete documentation index at: https://docs.syntblaze.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Go Value Receiver Method

A value receiver method in Go is a function bound to a specific type where the receiver argument is passed by value. When invoked, the method operates on a distinct, shallow copy of the original instance, ensuring that any state mutations within the method's scope do not affect the caller's original data.

## Syntax

The receiver is declared between the `func` keyword and the method name. It consists of an identifier and the base type (not a pointer).

```go theme={"dark"}
func (v Type) MethodName(parameterList) returnType {
    // v is a localized copy of the caller's value
}
```

## Technical Mechanics

**Pass-by-Value Semantics**
When a value receiver method is called, Go allocates new memory for the receiver and copies the data from the caller into this new memory space. Because it operates on a copy, any modifications made to the receiver's fields inside the method are discarded once the method returns.

**Automatic Dereferencing**
Go provides syntactic sugar for method invocations. You can call a value receiver method on a pointer to the type. The Go compiler automatically dereferences the pointer (`*p`) to extract the value before passing the copy to the method.

**Method Sets and Interfaces**
In Go's type system, the method set of a type determines which interfaces that type implements. A method with a value receiver `(t T)` is automatically included in the method set of both the value type `T` and the pointer type `*T`. Consequently, both `T` and `*T` can satisfy an interface that requires a value receiver method.

## Code Visualization

The following example demonstrates the isolation of mutations and automatic pointer dereferencing inherent to value receivers:

```go theme={"dark"}
package main

import "fmt"

type Vector struct {
    X, Y int
}

// Translate is a value receiver method.
// 'v' is a copy of the Vector used to invoke the method.
func (v Vector) Translate(dx, dy int) {
    v.X += dx
    v.Y += dy
    fmt.Printf("Inside method: %+v\n", v)
}

func main() {
    // 1. Invoking on a value
    val := Vector{X: 0, Y: 0}
    val.Translate(5, 5)
    // val remains {X: 0, Y: 0} because Translate mutated a copy
    fmt.Printf("After value call: %+v\n", val)

    // 2. Invoking on a pointer
    ptr := &Vector{X: 0, Y: 0}
    ptr.Translate(5, 5) // Compiler translates this to: (*ptr).Translate(5, 5)
    // ptr remains &{X: 0, Y: 0}
    fmt.Printf("After pointer call: %+v\n", ptr)
}
```

<div
  style={{ 
display: "flex", 
justifyContent: "space-between", 
alignItems: "center", 
maxWidth: "754px", 
padding: "1rem 0",
marginBottom: "24px"
}}
>
  <span style={{ fontWeight: "bold", fontSize: "1.25rem", color: "var(--tw-prose-headings)", fontFamily: "Inter, ui-sans-serif, system-ui, sans-serif" }}>Tired of Poor Go Skills? Fix That With Deep Grasping!</span>

  <a
    href="https://syntblaze.com"
    target="_blank"
    style={{ 
  marginLeft: "24px",
  textDecoration: "none", 
  backgroundColor: "#007AFF",
  color: "#ffffff", 
  padding: "6px 16px", 
  borderRadius: "16px",
  fontSize: "0.9rem",
  fontWeight: "600",
  textAlign: "center",
  transition: "background-color 0.2s ease"
}}
  >
    Learn More
  </a>
</div>

<div style={{ display: "flex", gap: "12px", flexWrap: "wrap" }}>
  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/skill-tracking.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=b9b0305c93bb501c9e767b5c76c88835" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/skill-tracking.png" />

  <img src="https://mintcdn.com/syntblazellc/23tyuOzaWS88qFlc/images/nuggets.png?fit=max&auto=format&n=23tyuOzaWS88qFlc&q=85&s=c86c80197299762989e9b882419b2109" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/nuggets.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/bite-sized-exercises.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=a65f9a38c37ff28ab73ed783c53c60e3" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/bite-sized-exercises.png" />
</div>

<div style={{ display: "flex", gap: "12px", flexWrap: "wrap", marginTop: "12px" }}>
  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/mastery-chain.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=748a1763454713e679260fbb95f154a2" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/mastery-chain.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/element-previews.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=242f61448ff5dd6deaaab2dccc13b507" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/element-previews.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/element-explanations.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=cf0fc1c31f9cd0fc26716781be05fbc9" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/element-explanations.png" />
</div>
