// Assume we have a FieldData variable called "data" with the following map values: // {"username": "john", "password": "secret"} // Get the value associated with the "username" key and check if it exists value, ok := data.GetOk("username") if ok { fmt.Println("The username is:", value) } else { fmt.Println("The username was not found.") }
The username is: john
// Assume we have a FieldData variable called "data" with the following map values: // {"username": "john", "password": "secret"} // Get the value associated with the "email" key and check if it exists value, ok := data.GetOk("email") if ok { fmt.Println("The email is:", value) } else { fmt.Println("The email was not found.") }
The email was not found.