<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>find on
A Scripter's Notes</title><link>https://scripter.co/tags/find/</link><description>Recent content in find
on A Scripter's Notes</description><language>en-us</language><managingEditor>kaushal.modi@gmail.com (Kaushal Modi)</managingEditor><webMaster>kaushal.modi@gmail.com (Kaushal Modi)</webMaster><lastBuildDate>Wed, 22 Apr 2026 08:24:58 -0400</lastBuildDate><generator>Hugo -- gohugo.io</generator><docs>https://validator.w3.org/feed/docs/rss2.html</docs><atom:link href="https://scripter.co/tags/find/index.xml" rel="self" type="application/rss+xml"/><item><title> Golang Quirk: Number-strings starting with "0" are Octals</title><link>https://scripter.co/golang-quirk-number-strings-starting-with-0-are-octals/</link><description>&lt;blockquote>Someone in the Golang team thought that it would be a good idea to
consider all numbers (represented as strings) starting with &amp;ldquo;0&amp;rdquo; as
Octals.. so &amp;ldquo;010&amp;rdquo; is actually 8.. Really?&lt;/blockquote>&lt;div class="ox-hugo-toc toc">
&lt;div class="heading">Table of Contents&lt;/div>
&lt;ul>
&lt;li>&lt;a href="#problem">Problem&lt;/a>&lt;/li>
&lt;li>&lt;a href="#cause">Cause&lt;/a>&lt;/li>
&lt;li>&lt;a href="#workaround">Workaround&lt;/a>&lt;/li>
&lt;li>&lt;a href="#resurgence">Resurgence&lt;/a>&lt;/li>
&lt;li>&lt;a href="#debug">Debug&lt;/a>&lt;/li>
&lt;li>&lt;a href="#next-steps">Next Steps?&lt;/a>&lt;/li>
&lt;/ul>
&lt;/div>
&lt;!--endtoc-->
&lt;p>The aim of this post is to make a Golang quirk more of a common
knowledge, with an ulterior motive to eventually get it fixed
upstream, somehow..&lt;/p>
&lt;div class="note">
&lt;p>&lt;strong>Disclaimer&lt;/strong>: I don&amp;rsquo;t code in Go lang. So I could very well be wrong
in saying &lt;em>problem with Golang&lt;/em> vs &lt;em>problem with specifically
&lt;code>strconv&lt;/code> package&lt;/em>.&lt;/p>
&lt;/div>
&lt;p>From my perspective, I see &lt;code>strconv&lt;/code> as an internal Go package that
any (most of?) Go coder would use to do &lt;em>string → int&lt;/em> conversions. If
so, I don&amp;rsquo;t grasp the rationale behind why the &lt;code>strconv&lt;/code> developers
would make this strange decision.. strange because in &lt;em>normal&lt;/em>
languages like Python, &lt;code>int(&amp;quot;010&amp;quot;)&lt;/code> returns &lt;code>10&lt;/code>.&lt;/p>
&lt;h2 id="problem">Problem&amp;nbsp;&lt;a class="headline-hash no-text-decoration" href="#problem">#&lt;/a>&lt;/h2>
&lt;p>I learned about this issue for the first time from &lt;a href="https://discourse.gohugo.io/t/unable-to-cast-09-of-type-string-to-int/9614/6?u=kaushalmodi">this Hugo Discourse
thread&lt;/a>. The synopsis is that someone is retrieving US city zip-codes
from a Hugo front-matter variable, and then using some conditional
logic based on the last 2 digits.&lt;/p>
&lt;p>So the code was:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-go-html-template" data-lang="go-html-template">&lt;span class="line">&lt;span class="cl">&lt;span class="c">&amp;lt;!-- Value of .Params.cityZipCode is &amp;#34;75009&amp;#34; --&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="cp">{{&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="k">if&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="o">(&lt;/span>&lt;span class="nx">int&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="o">(&lt;/span>&lt;span class="nx">last&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="nx">2&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="na">.Params.cityZipCode&lt;/span>&lt;span class="o">))&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="k">eq&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="nx">1&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="cp">}}&lt;/span>er&lt;span class="cp">{{&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="k">else&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="cp">}}&lt;/span>e&lt;span class="cp">{{&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="k">end&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="cp">}}&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>The logic is simple.. Get the last two characters of
&lt;code>.Params.cityZipCode&lt;/code>, which would be &lt;code>&amp;quot;09&amp;quot;&lt;/code>, convert that string to a
number (&lt;code>int&lt;/code>), and check if it is &lt;code>1&lt;/code>.&lt;/p>
&lt;p>But &lt;em>of-course&lt;/em> that didn&amp;rsquo;t work:&lt;/p>
&lt;blockquote>
&lt;p>unable to cast &amp;ldquo;09&amp;rdquo; of type string to int&lt;/p>
&lt;/blockquote>
&lt;h2 id="cause">Cause&amp;nbsp;&lt;a class="headline-hash no-text-decoration" href="#cause">#&lt;/a>&lt;/h2>
&lt;p>Later, as I learn, that&amp;rsquo;s because of the &lt;a href="https://golang.org/pkg/strconv/#ParseInt">&lt;code>ParseInt&lt;/code> function from the
&lt;code>strconv&lt;/code>&lt;/a> package. There it says (emphasis mine):&lt;/p>
&lt;blockquote>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-go" data-lang="go">&lt;span class="line">&lt;span class="cl">&lt;span class="kd">func&lt;/span> &lt;span class="nf">ParseInt&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="nx">s&lt;/span> &lt;span class="kt">string&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="nx">base&lt;/span> &lt;span class="kt">int&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="nx">bitSize&lt;/span> &lt;span class="kt">int&lt;/span>&lt;span class="p">)&lt;/span> &lt;span class="p">(&lt;/span>&lt;span class="nx">i&lt;/span> &lt;span class="kt">int64&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="nx">err&lt;/span> &lt;span class="kt">error&lt;/span>&lt;span class="p">)&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>&lt;code>ParseInt&lt;/code> interprets a string &lt;code>s&lt;/code> in the given &lt;code>base&lt;/code> (0, 2 to 36)
and &lt;code>bit&lt;/code> size (0 to 64) and returns the corresponding value &lt;code>i&lt;/code>.&lt;/p>
&lt;p>If &lt;code>base == 0&lt;/code>, the &lt;code>base&lt;/code> is implied by the string&amp;rsquo;s prefix: base 16
for &lt;code>&amp;quot;0x&amp;quot;&lt;/code>, &lt;strong>base 8 for &lt;code>&amp;quot;0&amp;quot;&lt;/code>&lt;/strong>, and base 10 otherwise. For bases 1,
below 0 or above 36 an error is returned.&lt;/p>
&lt;/blockquote>
&lt;div class="verse">
&lt;p>    Again.. What was the Golang team thinking?!&lt;br />&lt;/p>
&lt;/div>
&lt;h2 id="workaround">Workaround&amp;nbsp;&lt;a class="headline-hash no-text-decoration" href="#workaround">#&lt;/a>&lt;/h2>
&lt;p>This led me to update the &lt;a href="https://gohugo.io/functions/int/">&lt;code>int&lt;/code> function&lt;/a> documentation for Hugo with
an ugly workaround:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-go-html-template" data-lang="go-html-template">&lt;span class="line">&lt;span class="cl">&lt;span class="cp">{{&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="nx">int&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="o">(&lt;/span>&lt;span class="s">&amp;#34;00987&amp;#34;&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="o">|&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="nx">strings&lt;/span>&lt;span class="na">.TrimLeft&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="s">&amp;#34;0&amp;#34;&lt;/span>&lt;span class="o">)&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="cp">}}&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>
&lt;h2 id="resurgence">Resurgence&amp;nbsp;&lt;a class="headline-hash no-text-decoration" href="#resurgence">#&lt;/a>&lt;/h2>
&lt;p>This problem of &lt;em>number-strings beginning with &amp;ldquo;0&amp;rdquo; considered as
octals&lt;/em> resurfaced recently in Hugo issue #&lt;a href="https://github.com/gohugoio/hugo/issues/4628">4628&lt;/a>.&lt;/p>
&lt;p>Though, the reported error did not make it evident that that was the
problem:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-text" data-lang="text">&lt;span class="line">&lt;span class="cl">INFO 2018/04/15 18:49:36 found taxonomies: map[string]string{&amp;#34;category&amp;#34;:&amp;#34;categories&amp;#34;, &amp;#34;manufacturerletter&amp;#34;:&amp;#34;manufacturerletters&amp;#34;, &amp;#34;manufacturer&amp;#34;:&amp;#34;manufacturers&amp;#34;, &amp;#34;featured&amp;#34;:&amp;#34;featured&amp;#34;, &amp;#34;tag&amp;#34;:&amp;#34;tags&amp;#34;}
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">panic: interface conversion: interface {} is float64, not int
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">goroutine 50 [running]:
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">github.com/gohugoio/hugo/hugolib.(*Site).assembleTaxonomies(0xc4204ce2c0)
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> /go/src/github.com/gohugoio/hugo/hugolib/site.go:1545 +0xee2
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>The issue reporter had 1500+ content files, and one or more of those
files caused this uncaught exception (&lt;em>which is a separate issue, and
is planned to be fixed in Hugo&lt;/em>) to happen. So I had to spend quite
some time doing &amp;ldquo;forensic debug&amp;rdquo;&lt;sup id="fnref:1">&lt;a href="#fn:1" class="footnote-ref" role="doc-noteref">1&lt;/a>&lt;/sup> to understand what caused that
&lt;em>&amp;ldquo;interface conversion: interface {} is float64, not int&amp;rdquo;&lt;/em>.&lt;/p>
&lt;h2 id="debug">Debug&amp;nbsp;&lt;a class="headline-hash no-text-decoration" href="#debug">#&lt;/a>&lt;/h2>
&lt;ul>
&lt;li>
&lt;p>The exception was thrown at &lt;a href="https://github.com/gohugoio/hugo/blob/74520d2cfd39bb4428182e26c57afa9df83ce7b5/hugolib/site.go#L1545">this line&lt;/a> (highlighted below):&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-go" data-lang="go">&lt;span class="line">&lt;span class="cl">&lt;span class="k">for&lt;/span> &lt;span class="nx">_&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="nx">p&lt;/span> &lt;span class="o">:=&lt;/span> &lt;span class="k">range&lt;/span> &lt;span class="nx">s&lt;/span>&lt;span class="p">.&lt;/span>&lt;span class="nx">Pages&lt;/span> &lt;span class="p">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nx">vals&lt;/span> &lt;span class="o">:=&lt;/span> &lt;span class="nx">p&lt;/span>&lt;span class="p">.&lt;/span>&lt;span class="nf">getParam&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="nx">plural&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="p">!&lt;/span>&lt;span class="nx">s&lt;/span>&lt;span class="p">.&lt;/span>&lt;span class="nx">Info&lt;/span>&lt;span class="p">.&lt;/span>&lt;span class="nx">preserveTaxonomyNames&lt;/span>&lt;span class="p">)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nx">weight&lt;/span> &lt;span class="o">:=&lt;/span> &lt;span class="nx">p&lt;/span>&lt;span class="p">.&lt;/span>&lt;span class="nf">getParamToLower&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="nx">plural&lt;/span> &lt;span class="o">+&lt;/span> &lt;span class="s">&amp;#34;_weight&amp;#34;&lt;/span>&lt;span class="p">)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="k">if&lt;/span> &lt;span class="nx">weight&lt;/span> &lt;span class="o">==&lt;/span> &lt;span class="kc">nil&lt;/span> &lt;span class="p">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nx">weight&lt;/span> &lt;span class="p">=&lt;/span> &lt;span class="mi">0&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">}&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="k">if&lt;/span> &lt;span class="nx">vals&lt;/span> &lt;span class="o">!=&lt;/span> &lt;span class="kc">nil&lt;/span> &lt;span class="p">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="k">if&lt;/span> &lt;span class="nx">v&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="nx">ok&lt;/span> &lt;span class="o">:=&lt;/span> &lt;span class="nx">vals&lt;/span>&lt;span class="p">.([]&lt;/span>&lt;span class="kt">string&lt;/span>&lt;span class="p">);&lt;/span> &lt;span class="nx">ok&lt;/span> &lt;span class="p">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="k">for&lt;/span> &lt;span class="nx">_&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="nx">idx&lt;/span> &lt;span class="o">:=&lt;/span> &lt;span class="k">range&lt;/span> &lt;span class="nx">v&lt;/span> &lt;span class="p">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line hl">&lt;span class="cl"> &lt;span class="nx">x&lt;/span> &lt;span class="o">:=&lt;/span> &lt;span class="nx">WeightedPage&lt;/span>&lt;span class="p">{&lt;/span>&lt;span class="nx">weight&lt;/span>&lt;span class="p">.(&lt;/span>&lt;span class="kt">int&lt;/span>&lt;span class="p">),&lt;/span> &lt;span class="nx">p&lt;/span>&lt;span class="p">}&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;/li>
&lt;li>
&lt;p>So it was evident that one of the taxonomy weight
(&lt;code>manufacturers_weight&lt;/code> in this case) values wasn&amp;rsquo;t getting casted
to &lt;code>int&lt;/code>.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>So I grepped for anything &lt;em>non-int&lt;/em> in those values, like &lt;code>.&lt;/code>, &lt;code>,&lt;/code>,
&lt;code>e&lt;/code> or &lt;code>E&lt;/code>, but found nothing.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>Then doing &lt;code>rg ':\s[0-9]{7,}(\.[0-9]+)*$'&lt;/code> in the content files, I
saw that there were 4 files that had oddly high weight values like
4611000, and wondered if that was somehow the problem. But that
wasn&amp;rsquo;t it either.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>When I deleted &lt;strong>all&lt;/strong> the &lt;code>manufacturers_weight&lt;/code> lines in those 1500+
files, the error went away.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-shell" data-lang="shell">&lt;span class="line">&lt;span class="cl">find . -name &lt;span class="s2">&amp;#34;*.md&amp;#34;&lt;/span> -print0 &lt;span class="p">|&lt;/span> xargs -0 sed -i &lt;span class="s1">&amp;#39;/manufacturers_weight:.*/d&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;/li>
&lt;li>
&lt;p>So then I restored all of those deleted lines, and started deleting
them again, this time in progression ..&lt;/p>
&lt;ul>
&lt;li>First deleting all the lines with values with 7 or more
digits.. &lt;em>Error still present&lt;/em>.&lt;/li>
&lt;li>Then deleting all lines with values with 6 digits.. &lt;em>Error still present&lt;/em>.&lt;/li>
&lt;li>.. &lt;em>Error still present&lt;/em>.&lt;/li>
&lt;li>Finally when I deleted all lines with values with 4 digits, the
error went away!&lt;/li>
&lt;li>But by now, I had modified about 700 files in this process!&lt;/li>
&lt;/ul>
&lt;/li>
&lt;li>
&lt;p>I had almost given up on debugging this further, when I decided to
give the &lt;code>git diff&lt;/code> one last glance.. and I found the pattern..&lt;/p>
&lt;div class="verse">
&lt;p>    .. the &lt;em>freaking&lt;/em> leading 0&amp;rsquo;s in some of those &lt;code>manufacturers_weight&lt;/code> values!&lt;br />&lt;/p>
&lt;/div>
&lt;/li>
&lt;/ul>
&lt;p>I had a strong gut feeling that those zeros &lt;strong>were&lt;/strong> the problem. So I
once again restored the deleted lines in all the content files,
typed out the below&lt;sup id="fnref:2">&lt;a href="#fn:2" class="footnote-ref" role="doc-noteref">2&lt;/a>&lt;/sup> with confidence ..&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-shell" data-lang="shell">&lt;span class="line">&lt;span class="cl">find . -name &lt;span class="s2">&amp;#34;*.md&amp;#34;&lt;/span> -exec grep -P &lt;span class="s1">&amp;#39;manufacturers_weight: 0[0-9]+&amp;#39;&lt;/span> -l &lt;span class="o">{}&lt;/span> &lt;span class="se">\;&lt;/span> -exec sed -r -i &lt;span class="s1">&amp;#39;s/(manufacturers_weight: )0([0-9]+)/\1\2/&amp;#39;&lt;/span> &lt;span class="o">{}&lt;/span> &lt;span class="se">\;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;div class="verse">
&lt;p>    .. and that error was of course gone! 🎉&lt;br />&lt;/p>
&lt;/div>
&lt;p>This ended up with just 16 modified files with a diff like this:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-diff" data-lang="diff">&lt;span class="line">&lt;span class="cl">...
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">modified content/movements/b/buren/buren-04.en.md
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="gu">@@ -12,7 +12,7 @@ image: &amp;#34;Buren_04.jpg&amp;#34;
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="gu">&lt;/span> movementlistkey: &amp;#34;buren&amp;#34;
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> caliberkey: &amp;#34;04&amp;#34;
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> manufacturers: [&amp;#34;buren&amp;#34;]
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="gd">-manufacturers_weight: 04
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="gd">&lt;/span>&lt;span class="gi">+manufacturers_weight: 4
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="gi">&lt;/span> categories: [&amp;#34;movements&amp;#34;,&amp;#34;movements_b&amp;#34;,&amp;#34;movements_b_buren_en&amp;#34;]
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> widgets:
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> relatedmovements: true
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">modified content/movements/c/citizen/citizen-0153.de.md
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="gu">@@ -12,7 +12,7 @@ image: &amp;#34;Citizen_0153.jpg&amp;#34;
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="gu">&lt;/span> movementlistkey: &amp;#34;citizen&amp;#34;
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> caliberkey: &amp;#34;0153&amp;#34;
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> manufacturers: [&amp;#34;citizen&amp;#34;]
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="gd">-manufacturers_weight: 0153
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="gd">&lt;/span>&lt;span class="gi">+manufacturers_weight: 153
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="gi">&lt;/span> categories: [&amp;#34;movements&amp;#34;,&amp;#34;movements_c&amp;#34;,&amp;#34;movements_c_citizen&amp;#34;]
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> widgets:
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> relatedmovements: true
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">...
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>So that provided that issue originator a workaround so that they can
at least get their site built.&lt;/p>
&lt;p>But I hope that this &lt;em>0-leading octal&lt;/em> absurdity gets fixed at the
root level &amp;mdash; People should once again say with confidence, as they
learned as kids, that &amp;ldquo;010&amp;rdquo; is the same thing as &amp;ldquo;10&amp;rdquo;.&lt;/p>
&lt;h2 id="next-steps">Next Steps?&amp;nbsp;&lt;a class="headline-hash no-text-decoration" href="#next-steps">#&lt;/a>&lt;/h2>
&lt;ul>
&lt;li>
&lt;p>Hugo fixes this issue (&lt;a href="https://github.com/gohugoio/hugo/issues/4628">4628&lt;/a>) on its end by not making this exception
go uncaught, and instead let the user know that they magically added
a non-&lt;code>int&lt;/code>-castable &lt;em>octal&lt;/em> value in their content in X file on Y
line.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>The Golang team gives some serious thought to this &lt;del>stupid&lt;/del> &lt;em>(sorry
about that)&lt;/em> annoying decision:&lt;/p>
&lt;blockquote>
&lt;p>If &lt;code>base == 0&lt;/code>, the &lt;code>base&lt;/code> is implied by the string&amp;rsquo;s prefix: base 16
for &lt;code>&amp;quot;0x&amp;quot;&lt;/code>, &lt;strong>base 8 for &lt;code>&amp;quot;0&amp;quot;&lt;/code>&lt;/strong> ..&lt;/p>
&lt;/blockquote>
&lt;/li>
&lt;/ul>
&lt;div class="center">&lt;b>§&lt;/b>&lt;/div>
&lt;div class="footnotes" role="doc-endnotes">
&lt;hr>
&lt;ol>
&lt;li id="fn:1">
&lt;p>I call this &amp;ldquo;forensic debug&amp;rdquo; because I don&amp;rsquo;t know Go, and how
and where to add debug statements within the &lt;code>hugo&lt;/code> source code. So my
approach was to figure out which content file/line caused that error.&amp;#160;&lt;a href="#fnref:1" class="footnote-backref" role="doc-backlink">&amp;#x21a9;&amp;#xfe0e;&lt;/a>&lt;/p>
&lt;/li>
&lt;li id="fn:2">
&lt;p>That command finds all the &lt;code>.md&lt;/code> files in the current
directory, returns a list of file names wherein the
&lt;code>manufactureres_weight&lt;/code> value begins with &lt;code>0&lt;/code> using &lt;code>grep&lt;/code>, and then
surgically remove the leading zeros just in those short-listed files
using &lt;code>sed&lt;/code>.&amp;#160;&lt;a href="#fnref:2" class="footnote-backref" role="doc-backlink">&amp;#x21a9;&amp;#xfe0e;&lt;/a>&lt;/p>
&lt;/li>
&lt;/ol>
&lt;/div></description><author>Kaushal.Modi@fakeEmailToMakeValidatorHappy.com (Kaushal Modi)</author><category domain="https://scripter.co/categories/hugo">hugo</category><category domain="https://scripter.co/series/golang-octals">Golang Octals</category><category domain="https://scripter.co/tags/golang">golang</category><category domain="https://scripter.co/tags/octal">octal</category><category domain="https://scripter.co/tags/quirk">quirk</category><category domain="https://scripter.co/tags/strconv">strconv</category><category domain="https://scripter.co/tags/zero">zero</category><category domain="https://scripter.co/tags/string">string</category><category domain="https://scripter.co/tags/sed">sed</category><category domain="https://scripter.co/tags/find">find</category><category domain="https://scripter.co/tags/grep">grep</category><category domain="https://scripter.co/tags/go-template">go-template</category><guid>https://scripter.co/golang-quirk-number-strings-starting-with-0-are-octals/</guid><pubDate>Wed, 18 Apr 2018 16:29:00 -0400</pubDate></item></channel></rss>