🌟
z's
  • Hello
  • Cheatsheets
    • 🍂Docker Compose Services
    • 🌿Git
    • ▶️ Golang
      • Gotchas
    • ⛑️Helm
    • ☸️ Kubernetes Management
    • ☸️ Kubernetes Resources
    • ☸️Kubernetes Snippets
    • 🔨Tools Quicklinks
    • Tools and Useful Stuff
    • 🟠Using Ubuntu
    • Reference/Template Dockerfiles
  • How-Tos
    • Use Ubuntu
    • Use VSCode
    • Use AWS
    • Use Git
    • Use GPG keys
    • Use Digital Ocean
  • About Me
    • Want to work with me?
    • How to work with me
  • Useful Tools
    • Collaboration
      • Miro
    • Documentation
      • Gitbook
      • Notion
  • On Growing People
    • Ontological Coaching
    • Organization Development (OD)
    • Speech Acts
    • Books & Other Resources
  • On Creating Software
    • Product
    • Design
    • Development Environments
      • Introduction
      • Visual Studio Code/Codium
      • Public Key Infrastructure (PKI) Setup & Usage
    • Patterns
      • API Authentication
      • User Authentication
    • Languages/Formats
      • JavaScript
      • Golang
      • HTML
      • CSS
      • SQL
      • JSON
      • YAML
    • Code Logistics
    • Data Persistence
      • Cassandra
    • Software Architecture
    • System Observability
    • Cool Tools
    • Kubernetes
      • Resource Cheatsheet
      • 1/ Kubernetes in 5 Minutes
      • 2/ Setting up Kubernetes locally
      • 3/ Handling long-running workloads
      • 4/ Handling run-once workloads
Powered by GitBook
On this page

Was this helpful?

  1. Cheatsheets
  2. ▶️ Golang

Gotchas

Memory addresses in loops

What is the output of the targetValue pointer's value?

package main

import "fmt"

var tags = map[string]string{
  "one":   "one",
  "two":   "two",
  "three": "three",
}

func main() {
  targetKey := "two"
  var targetValue *string
  for key, value := range tags {
    if key == targetKey {
      targetValue = &value
    }
  }
  fmt.Println(*targetValue)
}
Previous▶️ GolangNextHelm

Last updated 2 years ago

Was this helpful?