DevOps Articles

Curated articles, resources, tips and trends from the DevOps World.

Should You Return Empty or Nil Slices in Go?

3 years ago blog.boot.dev

Summary: This is a summary of an article originally published by the source. Read the full original article here →

In Go, we often need to return zero values. Idiomatic Go encourages the use of guard clauses, and guard clauses necessitate the need to return early. When returning early with an error, by convention all other return values should be zero values.

Made with pure grit © 2024 Jetpack Labs Inc. All rights reserved. www.jetpacklabs.com