{"id":467,"date":"2026-05-30T09:00:00","date_gmt":"2026-05-30T03:30:00","guid":{"rendered":"https:\/\/smitabharat.com\/blog\/go-health-checks-readiness\/"},"modified":"2026-05-30T09:00:00","modified_gmt":"2026-05-30T03:30:00","slug":"go-health-checks-readiness","status":"publish","type":"post","link":"https:\/\/smitabharat.com\/blog\/go-health-checks-readiness\/","title":{"rendered":"Go Health Checks: Liveness and Readiness Probes"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Go health checks are small HTTP endpoints that tell a platform whether your service is alive and ready for traffic. In this post, you will learn the difference between liveness and readiness. Then we will build both endpoints in Go and test them without starting a real server.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This lesson continues from <a href=\"https:\/\/smitabharat.com\/blog\/go-microservices-basics\/\">Go microservices basics<\/a>. We also use ideas from <a href=\"https:\/\/smitabharat.com\/blog\/go-http-server-beginners\/\">Go HTTP server for beginners<\/a> and <a href=\"https:\/\/smitabharat.com\/blog\/go-context-beginners-guide\/\">Go context for beginners<\/a>. So it helps to read those first.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What Are Go Health Checks?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Every health check is a URL that answers one question. The answer is a status code, such as 200 for good and 503 for not good. Then a load balancer, Docker or Kubernetes calls this URL every few seconds and reacts to the result.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Think of a shop. Because a sign on the door says &#8220;Open&#8221; or &#8220;Closed&#8221;, customers do not walk in to check. In the same way, Go health checks show the platform the state of your service. No real work is needed for that.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Most services need two kinds of check. The first is called liveness, and the second is called readiness. Together, these two make up the core of Go health checks. They sound similar, but they answer different questions.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Liveness: Is the Process Running?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">This check asks if the program is alive or stuck. When the answer is no, the platform restarts the program. So it must be cheap, and it must not depend on other systems.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Readiness: Can It Serve Traffic?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">This check asks if the copy can handle requests right now. When the answer is no, the platform stops sending traffic to it. However, it does not restart the copy. For example, a copy that cannot reach its database is alive, yet it is not ready.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Why Go Health Checks Matter<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Without Go health checks, a platform only knows if the process exists. A service can run and still be useless. It may wait forever on a broken database, or it may be in the middle of shutting down. Here is what Go health checks give you.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Safe deployments<\/strong>: new copies receive traffic only after they report ready.<\/li>\n\n\n\n<li><strong>Self-healing<\/strong>: a stuck program gets restarted without a human.<\/li>\n\n\n\n<li><strong>Clean shutdowns<\/strong>: a copy that is stopping leaves the pool before it closes.<\/li>\n\n\n\n<li><strong>Faster debugging<\/strong>: you can see at a glance which copy is unhealthy.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">However, a badly designed health check can cause outages. If liveness checks the database, a database problem restarts every copy at once. Therefore, the split between the two checks matters a lot.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How Go Health Checks Work<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The platform calls two paths on your service, usually <code>\/healthz<\/code> for liveness and <code>\/readyz<\/code> for readiness. Your handler returns 200 when things are fine and 503 when they are not. The platform then decides what to do.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large\"><a href=\"https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-health-checks-readiness-diagram-1.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"640\" src=\"https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-health-checks-readiness-diagram-1-1024x640.png\" alt=\"Go Health Checks diagram showing the platform calling the liveness and readiness paths and reacting to each answer\" class=\"wp-image-445\" srcset=\"https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-health-checks-readiness-diagram-1-1024x640.png 1024w, https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-health-checks-readiness-diagram-1-300x188.png 300w, https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-health-checks-readiness-diagram-1-768x480.png 768w, https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-health-checks-readiness-diagram-1-1536x960.png 1536w, https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-health-checks-readiness-diagram-1-2048x1280.png 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">The platform calls the liveness path to decide on a restart and the readiness path to decide whether to send traffic. Readiness checks the database and the shutdown flag.<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Notice that liveness has no arrows going to other systems, while readiness has two. In other words, it only proves that the program can still answer HTTP. Readiness looks at the things that decide if real requests will succeed. That is why good Go health checks keep the two paths apart.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">What a Readiness Check Should Test<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Check only what your service needs for every request. A database connection is a good example. In contrast, a partner API that you call once a day is not. Its outage should not remove your service from traffic.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Why a Short Timeout Matters<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">A readiness check that hangs is worse than one that fails. So give each dependency check its own timeout, using a context. A fast 503 lets the platform react quickly, while a slow answer hides the problem.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Go Health Checks: Liveness vs Readiness<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The two checks have different jobs. The table below compares them.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Feature<\/th><th>Liveness<\/th><th>Readiness<\/th><\/tr><\/thead><tbody><tr><td>Question<\/td><td>Is the process alive?<\/td><td>Can it serve traffic now?<\/td><\/tr><tr><td>Checks dependencies<\/td><td>No<\/td><td>Yes, the ones it needs<\/td><\/tr><tr><td>Failure result<\/td><td>Platform restarts the copy<\/td><td>Platform stops sending traffic<\/td><\/tr><tr><td>Typical path<\/td><td>\/healthz<\/td><td>\/readyz<\/td><\/tr><tr><td>Must be<\/td><td>Very cheap<\/td><td>Fast, with a timeout<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large\"><a href=\"https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-health-checks-readiness-diagram-2.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"640\" src=\"https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-health-checks-readiness-diagram-2-1024x640.png\" alt=\"Go Health Checks diagram comparing liveness with readiness\" class=\"wp-image-446\" srcset=\"https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-health-checks-readiness-diagram-2-1024x640.png 1024w, https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-health-checks-readiness-diagram-2-300x188.png 300w, https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-health-checks-readiness-diagram-2-768x480.png 768w, https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-health-checks-readiness-diagram-2-1536x960.png 1536w, https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-health-checks-readiness-diagram-2-2048x1280.png 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">Liveness failure leads to a restart, while readiness failure only removes the copy from the traffic pool until it recovers.<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">So which one should check the database? Only readiness should. When the database is down, restarting the service does not fix anything. Instead, the right move is to stop traffic and wait.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Go Health Checks Hands-On: Build Both Endpoints<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Now let&#8217;s build the endpoints. We keep a small <code>Health<\/code> struct with two parts. One is an atomic flag that marks shutdown, and the other is a function that pings the database.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 1: The Handlers<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">First, the liveness handler always returns 200. Next, the readiness handler checks the shutdown flag and then the database, using a 500 millisecond timeout.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>type Health struct {\n\tshuttingDown atomic.Bool\n\tpingDB       func(ctx context.Context) error\n}\n\nfunc (h *Health) Live(w http.ResponseWriter, r *http.Request) {\n\tw.WriteHeader(http.StatusOK)\n\tfmt.Fprintln(w, \"ok\")\n}\n\nfunc (h *Health) Ready(w http.ResponseWriter, r *http.Request) {\n\tif h.shuttingDown.Load() {\n\t\thttp.Error(w, \"shutting down\", http.StatusServiceUnavailable)\n\t\treturn\n\t}\n\tctx, cancel := context.WithTimeout(r.Context(), 500*time.Millisecond)\n\tdefer cancel()\n\tif err := h.pingDB(ctx); err != nil {\n\t\thttp.Error(w, \"database not ready\", http.StatusServiceUnavailable)\n\t\treturn\n\t}\n\tfmt.Fprintln(w, \"ready\")\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Let&#8217;s look at the key lines. The <code>atomic.Bool<\/code> is safe to change from another goroutine, such as a signal handler. The context from <code>r.Context()<\/code> also cancels the ping if the caller gives up. Finally, <code>http.Error<\/code> sets the 503 status and the message in one call.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 2: Wire the Routes and Test Them<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Then we register both paths and call them with <code>httptest<\/code>. We flip the database state and the shutdown flag between the calls, so we can see each case.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>func main() {\n\tdbUp := true\n\th := &amp;Health{pingDB: func(ctx context.Context) error {\n\t\tif !dbUp {\n\t\t\treturn errors.New(\"connection refused\")\n\t\t}\n\t\treturn nil\n\t}}\n\tmux := http.NewServeMux()\n\tmux.HandleFunc(\"GET \/healthz\", h.Live)\n\tmux.HandleFunc(\"GET \/readyz\", h.Ready)\n\n\tcheck := func(label, path string) {\n\t\trec := httptest.NewRecorder()\n\t\tmux.ServeHTTP(rec, httptest.NewRequest(\"GET\", path, nil))\n\t\tfmt.Printf(\"%-22s %s -&gt; %d %s\", label, path, rec.Code, rec.Body.String())\n\t}\n\n\tcheck(\"normal\", \"\/healthz\")\n\tcheck(\"normal\", \"\/readyz\")\n\tdbUp = false\n\tcheck(\"database down\", \"\/healthz\")\n\tcheck(\"database down\", \"\/readyz\")\n\tdbUp = true\n\th.shuttingDown.Store(true)\n\tcheck(\"shutting down\", \"\/healthz\")\n\tcheck(\"shutting down\", \"\/readyz\")\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Here is the real output from our run.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>normal                 \/healthz -&gt; 200 ok\nnormal                 \/readyz -&gt; 200 ready\ndatabase down          \/healthz -&gt; 200 ok\ndatabase down          \/readyz -&gt; 503 database not ready\nshutting down          \/healthz -&gt; 200 ok\nshutting down          \/readyz -&gt; 503 shutting down<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">As you can see, liveness stays at 200 in every case. Readiness changes to 503 when the database is down and again during shutdown. This is exactly the behaviour you want from Go health checks. The platform keeps the copy running but stops sending it requests.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Go Health Checks with Docker and Kubernetes<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Platforms read your endpoints through a few settings. You do not write these in Go, yet you should know them. The table below lists the common ones.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Setting<\/th><th>What it controls<\/th><th>Typical value<\/th><\/tr><\/thead><tbody><tr><td>Path<\/td><td>Which URL the platform calls<\/td><td>\/healthz or \/readyz<\/td><\/tr><tr><td>Period<\/td><td>How often the call happens<\/td><td>Every 5 to 10 seconds<\/td><\/tr><tr><td>Timeout<\/td><td>How long the platform waits<\/td><td>1 to 2 seconds<\/td><\/tr><tr><td>Failure threshold<\/td><td>Misses in a row before action<\/td><td>3<\/td><\/tr><tr><td>Initial delay<\/td><td>Wait before the first call<\/td><td>Enough for startup<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Because of the failure threshold, one slow answer does not cause a restart. The platform acts only after several misses in a row. As a result, a short pause from garbage collection is not a problem. Still, your handler should answer well inside the timeout, so keep it light.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Health Checks and Graceful Shutdown<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">During a deploy, the platform sends a stop signal to the old copy. At that moment, your service should set the shutdown flag first. Then readiness turns to 503, and the platform removes the copy from the pool. After a short wait, you close the server and let running requests finish. Our <a href=\"https:\/\/smitabharat.com\/blog\/go-graceful-shutdown\/\">graceful shutdown guide<\/a> shows the full pattern. Also, the <a href=\"https:\/\/smitabharat.com\/blog\/go-docker-deployment\/\">Go Docker deployment guide<\/a> shows how to run the service in a container.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Common Mistakes with Go Health Checks<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Checking the database in liveness<\/strong>: a short database outage then restarts every copy. So keep liveness free of dependencies.<\/li>\n\n\n\n<li><strong>No timeout on dependency checks<\/strong>: a hung check blocks the probe. Therefore, always use a context with a deadline.<\/li>\n\n\n\n<li><strong>Checking too many things<\/strong>: one slow optional service should not take you out of traffic. Instead, check only the parts that every request needs.<\/li>\n\n\n\n<li><strong>Forgetting shutdown<\/strong>: a copy that keeps saying &#8220;ready&#8221; while it stops will drop requests.<\/li>\n\n\n\n<li><strong>Exposing details publicly<\/strong>: error text can leak internal names. So return short messages and log the details.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Best Practices for Go Health Checks<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Use two separate endpoints<\/strong>, because liveness and readiness solve different problems.<\/li>\n\n\n\n<li><strong>Return 200 or 503 only<\/strong>, since platforms read the status code and ignore the body.<\/li>\n\n\n\n<li><strong>Keep checks fast<\/strong>, ideally under 100 milliseconds in the normal case, since probes run all day.<\/li>\n\n\n\n<li><strong>Flip readiness to false first on shutdown<\/strong>, then wait a moment before you stop the server.<\/li>\n\n\n\n<li><strong>Treat Go health checks as public plumbing and skip login on probe paths<\/strong>, because the platform cannot send credentials.<\/li>\n\n\n\n<li><strong>Log failures<\/strong>, so you can see why a copy left the pool.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Practice Task<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">To practise Go health checks, add a <code>\/startupz<\/code> endpoint that returns 503 until a warm-up step finishes. For example, the step can load a cache from a file.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Hint: use another <code>atomic.Bool<\/code>, and set it to true when the warm-up ends. Then test it with <code>httptest<\/code>, as we did here. After that, compare the three endpoints in a table, as we did above.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Official Resources<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">These pages describe the packages and ideas used in this lesson.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/pkg.go.dev\/net\/http\">net\/http package documentation<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/pkg.go.dev\/sync\/atomic\">sync\/atomic package documentation<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/kubernetes.io\/docs\/tasks\/configure-pod-container\/configure-liveness-readiness-startup-probes\/\">Kubernetes: configure liveness, readiness and startup probes<\/a><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Quick Recap<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Go health checks are HTTP paths that report the state of a service.<\/li>\n\n\n\n<li>Liveness asks if the process is alive, and it must not check other systems.<\/li>\n\n\n\n<li>Readiness asks if the copy can serve traffic, so it checks needed dependencies.<\/li>\n\n\n\n<li>Use a timeout for every dependency check.<\/li>\n\n\n\n<li>Flip readiness to false at the start of a shutdown.<\/li>\n\n\n\n<li>A failed liveness check restarts the copy, while a failed readiness check only stops traffic.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">What&#8217;s Next?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">By now, you can tell a platform when your service is healthy. However, calls between services still fail from time to time. So next, we will retry them safely with exponential backoff and jitter.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Next up: <a href=\"https:\/\/smitabharat.com\/blog\/go-retry-backoff-jitter\/\">Go retry with exponential backoff and jitter<\/a><\/p>\n\n","protected":false},"excerpt":{"rendered":"<p>Go health checks are small HTTP endpoints that tell a platform whether your service is alive and ready for traffic. In this post, you&hellip;<\/p>\n","protected":false},"author":1,"featured_media":447,"comment_status":"","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_swapz_level":"","_swapz_series_part":0,"_swapz_hide_toc":false,"_swapz_hide_featured":false,"_swapz_description":"","footnotes":""},"categories":[15],"tags":[86,11,77],"swapz_series":[],"class_list":["post-467","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-go-lang","tag-go-health-checks","tag-go-lang","tag-intermediate"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Go Health Checks: Liveness and Readiness Probes<\/title>\n<meta name=\"description\" content=\"Learn Go health checks with liveness and readiness endpoints. Build both in Go, add timeouts, and test them with httptest in simple steps.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/smitabharat.com\/blog\/go-health-checks-readiness\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Go Health Checks: Liveness and Readiness Probes\" \/>\n<meta property=\"og:description\" content=\"Learn Go health checks with liveness and readiness endpoints. Build both in Go, add timeouts, and test them with httptest in simple steps.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/smitabharat.com\/blog\/go-health-checks-readiness\/\" \/>\n<meta property=\"og:site_name\" content=\"Smita Bharat - Blog\" \/>\n<meta property=\"article:published_time\" content=\"2026-05-30T03:30:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-health-checks-readiness-featured.png\" \/>\n\t<meta property=\"og:image:width\" content=\"2400\" \/>\n\t<meta property=\"og:image:height\" content=\"1260\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Smita\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Smita\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-health-checks-readiness\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-health-checks-readiness\\\/\"},\"author\":{\"name\":\"Smita\",\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/#\\\/schema\\\/person\\\/27a1b1067d396703215c54acedbfd339\"},\"headline\":\"Go Health Checks: Liveness and Readiness Probes\",\"datePublished\":\"2026-05-30T03:30:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-health-checks-readiness\\\/\"},\"wordCount\":1546,\"publisher\":{\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/#\\\/schema\\\/person\\\/27a1b1067d396703215c54acedbfd339\"},\"image\":{\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-health-checks-readiness\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/10\\\/go-health-checks-readiness-featured.png\",\"keywords\":[\"Go Health Checks\",\"Go Lang\",\"Intermediate\"],\"articleSection\":[\"Go Lang\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-health-checks-readiness\\\/\",\"url\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-health-checks-readiness\\\/\",\"name\":\"Go Health Checks: Liveness and Readiness Probes\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-health-checks-readiness\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-health-checks-readiness\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/10\\\/go-health-checks-readiness-featured.png\",\"datePublished\":\"2026-05-30T03:30:00+00:00\",\"description\":\"Learn Go health checks with liveness and readiness endpoints. Build both in Go, add timeouts, and test them with httptest in simple steps.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-health-checks-readiness\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-health-checks-readiness\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-health-checks-readiness\\\/#primaryimage\",\"url\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/10\\\/go-health-checks-readiness-featured.png\",\"contentUrl\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/10\\\/go-health-checks-readiness-featured.png\",\"width\":2400,\"height\":1260,\"caption\":\"Go Health Checks featured image: liveness, readiness and not ready cards\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-health-checks-readiness\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Go Health Checks: Liveness and Readiness Probes\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/\",\"name\":\"Smita Bharat Blog\",\"description\":\"Golang &amp; Backend Development Tutorials and Interview Questions\",\"publisher\":{\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/#\\\/schema\\\/person\\\/27a1b1067d396703215c54acedbfd339\"},\"alternateName\":\"Smita Bharat\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/#\\\/schema\\\/person\\\/27a1b1067d396703215c54acedbfd339\",\"name\":\"Smita\",\"logo\":{\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/#\\\/schema\\\/person\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/smitabharat.com\\\/blog\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Go Health Checks: Liveness and Readiness Probes","description":"Learn Go health checks with liveness and readiness endpoints. Build both in Go, add timeouts, and test them with httptest in simple steps.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/smitabharat.com\/blog\/go-health-checks-readiness\/","og_locale":"en_US","og_type":"article","og_title":"Go Health Checks: Liveness and Readiness Probes","og_description":"Learn Go health checks with liveness and readiness endpoints. Build both in Go, add timeouts, and test them with httptest in simple steps.","og_url":"https:\/\/smitabharat.com\/blog\/go-health-checks-readiness\/","og_site_name":"Smita Bharat - Blog","article_published_time":"2026-05-30T03:30:00+00:00","og_image":[{"width":2400,"height":1260,"url":"https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-health-checks-readiness-featured.png","type":"image\/png"}],"author":"Smita","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Smita","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/smitabharat.com\/blog\/go-health-checks-readiness\/#article","isPartOf":{"@id":"https:\/\/smitabharat.com\/blog\/go-health-checks-readiness\/"},"author":{"name":"Smita","@id":"https:\/\/smitabharat.com\/blog\/#\/schema\/person\/27a1b1067d396703215c54acedbfd339"},"headline":"Go Health Checks: Liveness and Readiness Probes","datePublished":"2026-05-30T03:30:00+00:00","mainEntityOfPage":{"@id":"https:\/\/smitabharat.com\/blog\/go-health-checks-readiness\/"},"wordCount":1546,"publisher":{"@id":"https:\/\/smitabharat.com\/blog\/#\/schema\/person\/27a1b1067d396703215c54acedbfd339"},"image":{"@id":"https:\/\/smitabharat.com\/blog\/go-health-checks-readiness\/#primaryimage"},"thumbnailUrl":"https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-health-checks-readiness-featured.png","keywords":["Go Health Checks","Go Lang","Intermediate"],"articleSection":["Go Lang"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/smitabharat.com\/blog\/go-health-checks-readiness\/","url":"https:\/\/smitabharat.com\/blog\/go-health-checks-readiness\/","name":"Go Health Checks: Liveness and Readiness Probes","isPartOf":{"@id":"https:\/\/smitabharat.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/smitabharat.com\/blog\/go-health-checks-readiness\/#primaryimage"},"image":{"@id":"https:\/\/smitabharat.com\/blog\/go-health-checks-readiness\/#primaryimage"},"thumbnailUrl":"https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-health-checks-readiness-featured.png","datePublished":"2026-05-30T03:30:00+00:00","description":"Learn Go health checks with liveness and readiness endpoints. Build both in Go, add timeouts, and test them with httptest in simple steps.","breadcrumb":{"@id":"https:\/\/smitabharat.com\/blog\/go-health-checks-readiness\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/smitabharat.com\/blog\/go-health-checks-readiness\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/smitabharat.com\/blog\/go-health-checks-readiness\/#primaryimage","url":"https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-health-checks-readiness-featured.png","contentUrl":"https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-health-checks-readiness-featured.png","width":2400,"height":1260,"caption":"Go Health Checks featured image: liveness, readiness and not ready cards"},{"@type":"BreadcrumbList","@id":"https:\/\/smitabharat.com\/blog\/go-health-checks-readiness\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/smitabharat.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Go Health Checks: Liveness and Readiness Probes"}]},{"@type":"WebSite","@id":"https:\/\/smitabharat.com\/blog\/#website","url":"https:\/\/smitabharat.com\/blog\/","name":"Smita Bharat Blog","description":"Golang &amp; Backend Development Tutorials and Interview Questions","publisher":{"@id":"https:\/\/smitabharat.com\/blog\/#\/schema\/person\/27a1b1067d396703215c54acedbfd339"},"alternateName":"Smita Bharat","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/smitabharat.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/smitabharat.com\/blog\/#\/schema\/person\/27a1b1067d396703215c54acedbfd339","name":"Smita","logo":{"@id":"https:\/\/smitabharat.com\/blog\/#\/schema\/person\/image\/"},"sameAs":["https:\/\/smitabharat.com\/blog"]}]}},"_links":{"self":[{"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/posts\/467","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/comments?post=467"}],"version-history":[{"count":0,"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/posts\/467\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/media\/447"}],"wp:attachment":[{"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/media?parent=467"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/categories?post=467"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/tags?post=467"},{"taxonomy":"swapz_series","embeddable":true,"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/swapz_series?post=467"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}