<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Debug on Gopher Coding</title><link>https://gophercoding.com/tags/debug/</link><description>Recent content in Debug on Gopher Coding</description><generator>Hugo</generator><language>en-gb</language><lastBuildDate>Sun, 09 Apr 2023 10:11:34 +0100</lastBuildDate><atom:link href="https://gophercoding.com/tags/debug/index.xml" rel="self" type="application/rss+xml"/><item><title>Reduce Go Binary Size</title><link>https://gophercoding.com/reduce-go-binary-size/</link><pubDate>Thu, 06 Apr 2023 18:00:00 +0000</pubDate><guid>https://gophercoding.com/reduce-go-binary-size/</guid><description>&lt;p>Always a &lt;a href="https://github.com/xaionaro/documentation/blob/master/golang/reduce-binary-size.md">hot&lt;/a>-&lt;a href="https://github.com/golang/go/issues/6853">topic&lt;/a> in Go circles is binary size of applications. In this post we will show you how you can reduce the binary size produced from &lt;code>go build&lt;/code> for leaner, slimer builds.&lt;/p>
&lt;p>In short, adding the &lt;strong>ldflags&lt;/strong> shown below will reduce the size of the binary produced. It does this by removing some perhaps non-critial parts (shouldn&amp;rsquo;t affect execution, only debugging potentially).&lt;/p>
&lt;p>&lt;strong>&lt;code>-s&lt;/code>&lt;/strong> Will turn off the symbol table, so you won&amp;rsquo;t be able to use commands like &lt;code>go tool nm&lt;/code>.&lt;/p></description></item><item><title>How to Die Dump in Go - dd()</title><link>https://gophercoding.com/how-to-die-dump-in-go/</link><pubDate>Sun, 06 Nov 2022 07:00:00 +0000</pubDate><guid>https://gophercoding.com/how-to-die-dump-in-go/</guid><description>&lt;p>Having come from the PHP community, we often have a handy debug function at our disposal &lt;code>dd()&lt;/code> (part of Laravel) and &lt;code>var_dump()&lt;/code> (native). This may not be perfect (compared with a full on debugging suite) but it is a quick and easy debugging method. This post gives an idea on how you can do the same, but in Go.&lt;/p>
&lt;p>We&amp;rsquo;re helped out by being able to use both variable parameters (shown with &lt;code>...&lt;/code>) and the interface type to handle different types, both strings and integers in our examples.&lt;/p></description></item></channel></rss>