This code compiles without warnings and runs successfully, but it contains a bug that could bite you. What do you think this code will output, and why doesn't the update operation work as expected? Share your analysis in the comments.
Thanks for sharing
Insightful, thank you
I'm with you
The answer is Alex. The key reason is that Go structs are value types. When you do users ["admin"] = u, you're placing a copy of the user into the map. The subsequent change to u. Name only affects the original variable, not the copy. To make the update work, you need to use pointers, which act as a reference to the original data. Simply change the map to map[string]*User and add the item with users ["admin"] = &u. HOPE I DID GOOD
sir I am Rupsa Kundu from kolkata. I am 1st year student , currently,persuing btech in cse. So how should I start preparation for industrial from 1st year? which programming language should be required in industrial for app developement?
???? ??
I agree
I agree ??
I Help People Find Online Jobs, WFH Jobs & Freelancing Opportunities
2 天前Well saidSourabh Kumar · 3rd+ Assistant Supervisor at BELIEV... KRISNA ARORA Online Work from Home ?? TIME. : Flexible timings (part-time/full time) Income : ?15,000 - ?25,000/- AGE. : 18+ Edu. : 10th to any degree Work : Social Media Work (Instagram, Facebook, LinkedIn etc.) Freshers can apply. If you're interested then msg on this number ?? 7830720362 NOTE: Only For Serious and Passionate people who want to learn and grow.