Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

YouTube

Pointer Receivers in Go

Gary Clarke via YouTube

Overview

Coursera Flash Sale
40% Off Coursera Plus for 3 Months!
Grab it
Learn how to implement pointer receivers in Go methods to modify original values and avoid unnecessary copying in this 11-minute tutorial. Discover the fundamental differences between pointer receivers written as `(c *Counter)` and value receivers `(c Counter)`, understanding that pointer receivers give methods access to the original value in memory rather than a copy. Explore when to use pointer receivers for modifying struct state and avoiding expensive copying operations, while mastering Go's automatic address-taking feature that allows you to call pointer receiver methods directly on values with clean, consistent syntax. Understand the core principles of choosing between value and pointer receivers based on whether your method needs to modify data or maintain efficiency, with practical examples demonstrating how pointer receivers enable mutable state management and memory optimization. Practice implementing pointer receiver methods that can update struct fields and compare their behavior against value receivers that operate on copies, gaining essential knowledge for writing efficient Go programs that handle struct modifications properly.

Syllabus

Pointer Receivers in Go

Taught by

Gary Clarke

Reviews

Start your review of Pointer Receivers in Go

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.