FlareStart
HomeNewsHow ToSources
FlareStart

Where developers start their day. All the tech news & tutorials that matter, in one place.

Quick Links

  • Home
  • News
  • Tutorials
  • Sources
  • Privacy Policy

Connect

© 2026 FlareStart. All rights reserved.

Back to articles
Go Slices: Why Your Function Isn't Changing What You Think It Is
How-ToMachine Learning

Go Slices: Why Your Function Isn't Changing What You Think It Is

via Dev.toRahul Tomer3h ago

15 min read · Beginner-friendly · Real code you can paste into Go Playground The bug that confuses every Go beginner You pass your slice to a function. The function changes some values. You print the slice back in main ... and some changes are there, some aren't. Sound familiar? This article explains exactly why — with diagrams, not walls of text. Our data — a fleet of vehicles Two structs, one slice. Everything in this article uses these types. type VehicleType struct { TwoWheeler , ThreeWheeler , FourWheeler bool } type Vehicle struct { Model , Color string Type VehicleType // nested by value — not a pointer } type Fleet [] Vehicle Fill it with two vehicles: fleet := Fleet { { Model : "Bike" , Color : "Red" , Type : VehicleType { TwoWheeler : true }}, { Model : "Car" , Color : "Blue" , Type : VehicleType { FourWheeler : true }}, } What is a slice? (the sticky note model) Before anything else, burn this mental model in — a slice variable is just a 3-field sticky note . The real data l

Continue reading on Dev.to

Opens in a new tab

Read Full Article
5 views

Related Articles

I Got a $40 Parking Fine, So I’m Building an App That Fixes It
How-To

I Got a $40 Parking Fine, So I’m Building an App That Fixes It

Medium Programming • 3h ago

Here Is What Programming Taught Me About Solving Real-World Problems
How-To

Here Is What Programming Taught Me About Solving Real-World Problems

Medium Programming • 4h ago

How to Add a Custom Tool to Your MCP Server (Step by Step)
How-To

How to Add a Custom Tool to Your MCP Server (Step by Step)

Dev.to Tutorial • 7h ago

I Was Great at Power BI — Until I Realized I Was Useless in Real Projects
How-To

I Was Great at Power BI — Until I Realized I Was Useless in Real Projects

Medium Programming • 7h ago

I Studied What the Top 0.1%
How-To

I Studied What the Top 0.1%

Medium Programming • 15h ago

Discover More Articles