Our website uses cookies to enhance your browsing experience.
Accept
to the top

Webinar: Let's make a programming language. Lexer - 29.04

>
>
>
V8002. Variable is assigned to itself.
menu mobile close menu
Additional information
toggle menu Contents

V8002. Variable is assigned to itself.

Apr 03 2026

The analyzer detected a potential error related to a variable value assigned to itself.

The example:

type User struct {
    name string
}

func (u *User) SetName (name string) {
    name = name
}

The name parameter is assigned its own value, which is an error. To fix it, assign the parameter value to the u.name field instead:

func (u *User) SetName (name string) {
    u.name = name
}