Curated articles, resources, tips and trends from the DevOps World.
Summary: This is a summary of an article originally published by the source. Read the full original article here →
Constants can be confusing and easy to misuse in Go if you are coming from an untyped language. Let’s take a look at some of the nuanced details of how they work in Go.
Go and JavaScript both declare new constants in the same way: The takeaway if you are coming from JavaScript is that Go’s constants are just different.
In Go, constants provide complete safety in regards to the value they hold.
However, I have written another article on the elegant ways to get “effectively constant” slices and maps in Go.
Made with pure grit © 2024 Jetpack Labs Inc. All rights reserved. www.jetpacklabs.com