---
title: "Comment by Rodolfo Albuquerque on \"When Should You Use Pointers in Go\" | Hashnode"
description: "Hey Pavle, great article! A question I have about the first reason on why to use pointers - Changing the state of an object - would be, couldn&#39;t you, for ex"
url: "https://hashnode.com/posts/when-should-you-use-pointers-in-go/618d2f3ff991b025366e2c8c/comment/62dd5de3b12ca5754f6a6f0e"
---

[Discussion](https://hashnode.com/posts/when-should-you-use-pointers-in-go/618d2f3ff991b025366e2c8c)

Comment [When Should You Use Pointers in Go](https://hashnode.com/posts/when-should-you-use-pointers-in-go/618d2f3ff991b025366e2c8c)

[Rodolfo Albuquerque](https://hashnode.com/@rdalbuquerque)

[Jul 24, 2022](https://hashnode.com/posts/when-should-you-use-pointers-in-go/618d2f3ff991b025366e2c8c/comment/62dd5de3b12ca5754f6a6f0e)

Hey Pavle, great article!

A question I have about the first reason on why to use pointers - `Changing the state of an object` - would be, couldn't you, for example, pass the value, change it in a function and return the changed value so the calling function would reassign the original variable with the new returned value? Wouldn't it change the state of the object as well?

I get the overall point tho, thanks!

[Pavle Djuric](https://hashnode.com/@pavledjuric)

[Jul 24, 2022](https://hashnode.com/posts/when-should-you-use-pointers-in-go/618d2f3ff991b025366e2c8c/comment/62dd5de3b12ca5754f6a6f0e#reply-62ddbb64b12ca5754f6a7a43)

Hi Rodolfo. Thanks for the kind words. To answer your question - in order to update the value of an already defined variable, you need to use pointers. You can however, pass this variable into an argument of a function, update it and then return the new value. This is how the append function works in Go, for example. This will not update the original variable however. It is more of a functional approach, which favors immutability. Both options work, it just depends on what you prefer and what makes more sense in that particular situation.
