<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/ok-considered-harmful-sg0zhkc4o" -->

---
title: ok Considered Harmful | daily.dev
description: The post discusses the convention of naming boolean existence variables in Go as &#x27;ok&#x27;, and argues that it is harmful and should be replaced with a more...
canonical: https://daily.dev/posts/ok-considered-harmful-sg0zhkc4o
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: ok Considered Harmful | daily.dev
og:description: The post discusses the convention of naming boolean existence variables in Go as &#x27;ok&#x27;, and argues that it is harmful and should be replaced with a more...
og:url: https://daily.dev/posts/ok-considered-harmful-sg0zhkc4o
og:image: https://api.daily.dev/og/posts/Sg0zHKC4o.png
og:image:alt: ok Considered Harmful
og:image:width: 1200
og:image:height: 630
og:locale: en
---

[Lobsters](https://daily.dev/sources/lobsters)

[Read post](https://api.daily.dev/r/Sg0zHKC4o)

# [ok Considered Harmful](https://api.daily.dev/r/Sg0zHKC4o "Go to post")

The post discusses the convention of naming boolean existence variables in Go as 'ok', and argues that it is harmful and should be replaced with a more descriptive convention such as 'exists'. It provides examples and benefits of using the new convention.

[#golang](/tags/golang "Check all #golang posts")

May 15, 2024•10m read time•From [dolthub.com](https://api.daily.dev/r/Sg0zHKC4o "dolthub.com")

[![Post cover image](https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/7e68b8ff2a6ac0a3a6bba43f69a37f9b?_a=AQAEuiZ)](https://api.daily.dev/r/Sg0zHKC4o "Go to post")

Table of contents

[Introduction](https://api.daily.dev/r/Sg0zHKC4o?a=introduction "Introduction")[ok](https://api.daily.dev/r/Sg0zHKC4o?a=ok "ok")[ok: Not for just maps](https://api.daily.dev/r/Sg0zHKC4o?a=ok-not-for-just-maps "ok: Not for just maps")[ok Considered Harmful](https://api.daily.dev/r/Sg0zHKC4o?a=ok-considered-harmful "ok Considered Harmful")[A better alternative exists](https://api.daily.dev/r/Sg0zHKC4o?a=a-better-alternative-exists "A better alternative exists")[Variation: optional channel receives](https://api.daily.dev/r/Sg0zHKC4o?a=variation-optional-channel-receives "Variation: optional channel receives")[But I like using ok](https://api.daily.dev/r/Sg0zHKC4o?a=but-i-like-using-ok "But I like using ok")[An exception: type assertions](https://api.daily.dev/r/Sg0zHKC4o?a=an-exception-type-assertions "An exception: type assertions")[Doesn't this apply to err as well?](https://api.daily.dev/r/Sg0zHKC4o?a=doesnt-this-apply-to-err-as-well "Doesn't this apply to err as well?")[Conclusion](https://api.daily.dev/r/Sg0zHKC4o?a=conclusion "Conclusion")

628 Impressions5 Upvotes1 Comment

Comment

Bookmark

Copy

![Placeholder image for anonymous user](https://media.daily.dev/image/upload/s--qsFuKGv_--/t_logo,f_auto/public/noProfile)Share your thoughtsPost

[![Lobsters's image](https://media.daily.dev/image/upload/s--tl8v_Fku--/f_auto,t_logo/v1698841318/logos/lobste.jpg)](https://daily.dev/sources/lobsters)

[Lobsters](https://daily.dev/sources/lobsters "https://daily.dev/sources/lobsters")

Lobsters is a community-driven platform for sharing and discussing links to articles, tutorials, and... Read more

1.9K Followers

•

36.3K Upvotes

#### Would you recommend this post?

Copy link

WhatsApp

Facebook

X

New Squad

Copy linkShare with your friends

5

1

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"ok Considered Harmful","url":"https://daily.dev/posts/ok-considered-harmful-sg0zhkc4o","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/ok-considered-harmful-sg0zhkc4o"},"datePublished":"2024-05-15T09:45:54.872Z","dateModified":"2024-05-15T09:45:52.658Z","description":"The post discusses the convention of naming boolean existence variables in Go as 'ok', and argues that it is harmful and should be replaced with a more...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/7e68b8ff2a6ac0a3a6bba43f69a37f9b?_a=AQAEuiZ","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/7e68b8ff2a6ac0a3a6bba43f69a37f9b?_a=AQAEuiZ","isAccessibleForFree":true,"articleSection":"Lobsters","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Lobsters","logo":"https://media.daily.dev/image/upload/s--tl8v_Fku--/f_auto,t_logo/v1698841318/logos/lobste.jpg","url":"https://daily.dev/sources/lobsters"},"commentCount":1,"discussionUrl":"https://daily.dev/posts/ok-considered-harmful-sg0zhkc4o","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":5},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":1}],"keywords":"golang","timeRequired":"PT10M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Lobsters","item":"https://daily.dev/sources/lobsters"},{"@type":"ListItem","position":3,"name":"ok Considered Harmful"}]}
{"@context":"https://schema.org","@type":"WebPage","@id":"https://daily.dev/posts/ok-considered-harmful-sg0zhkc4o","comment":[{"@type":"Comment","text":"ah, unfortunately, variable scoping sucks in go, you run out of identifiers very quickly, especially on package level","datePublished":"2024-06-07T17:50:33.881Z","url":"https://daily.dev/posts/Sg0zHKC4o#c-wf1ifQQgt","author":{"@type":"Person","name":"Mykyta Nikitenko","url":"https://daily.dev/mykytanikitenko42","image":"https://lh3.googleusercontent.com/a/AAcHTtfurSXqjGczJrC4WFT2LrMQYjGe-Qrau5HTeaP1=s96-c"}}]}
```

