paint-brush
How to Append to a Slice in Golangby@pgaijin66
614 reads
614 reads

How to Append to a Slice in Golang

by Prabesh Thapa7mOctober 21st, 2022
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

Slices in Go are not the same as slices in another programming language i.e Python. Assigning one slice to another only makes a shallow copy of the slice and should be used cautiously if you want to create a new slice from the existing slice. Go lang is easier to understand and get started with but it has its intricacies. I was working on a project and came across this behavior. I had a similar requirement where I had to manipulate slices and create new ones using Go. Thinking that it would be similar to other languages, I followed a similar approach.
featured image - How to Append to a Slice in Golang
Prabesh Thapa HackerNoon profile picture
Prabesh Thapa

Prabesh Thapa

@pgaijin66

I am SRE with software engineering experience. I love building tools to improve developer productivity.

L O A D I N G
. . . comments & more!

About Author

Prabesh Thapa HackerNoon profile picture
Prabesh Thapa@pgaijin66
I am SRE with software engineering experience. I love building tools to improve developer productivity.

TOPICS

THIS ARTICLE WAS FEATURED IN...

Permanent on Arweave
Read on Terminal Reader
Read this story in a terminal
 Terminal
Read this story w/o Javascript
Read this story w/o Javascript
 Lite