<?xml version="1.0" encoding="UTF-8"?><feed xmlns="http://www.w3.org/2005/Atom">
  <title>Øyvind Gerrard Skaar</title>
  <id>https://oyvindsk.com/posts</id>
  <updated>2024-04-10T00:00:00Z</updated>
  <subtitle>Øyvinds blog</subtitle>
  <link href="https://oyvindsk.com/posts"></link>
  <author>
    <name>Øyvind Gerrard Skaar</name>
    <email>hello@oyvindsk.com</email>
  </author>
  <entry>
    <title>Prototyping with NoCode and AI tools</title>
    <updated>2024-04-10T00:00:00Z</updated>
    <id>tag:oyvindsk.com,2024-04-10:/posts/nocode-and-ai-tools-for-prototyping</id>
    <content type="html">&lt;p&gt;I&#39;m currently trying out lots of different No-code and AI tools to&#xA;create mobile and web apps. The goal is to be able to make prototypes&#xA;and MVP&#39;s much faster and cheaper.&lt;/p&gt;&#xA;&lt;p&gt;Startups and others who want to create something new are often faced&#xA;with a dilemma: They would like to create an app of some sort to test&#xA;their idea and to have something to show off.&lt;br&gt;&#xA;But, unless you are a developer and designer, it can quickly cost a at&#xA;least a few hundrede thousand dollars. And even if you can do it&#xA;yourself, it takes a long time to create things &amp;quot;from scratch&amp;quot;.&lt;/p&gt;&#xA;&lt;p&gt;All these tools have disadvantages. But given that the advantages are so&#xA;great, I think it can be a good solution for many.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Advantages&lt;/strong&gt;: Create something quick and cheap. Do it yourself.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Cons&lt;/strong&gt;: There&#39;s still a lot to learn. The result &lt;em&gt;could&lt;/em&gt; be worse.&#xA;Many different tools, with their own advantages and disadvantages.&lt;/p&gt;&#xA;&lt;p&gt;As a developer, I enjoy programming. But I also like to make things,&#xA;with or without coding.&lt;/p&gt;&#xA;&lt;p&gt;So I&#39;m testing many of these tools and platforms and will share my&#xA;experiences here&lt;/p&gt;&#xA;&lt;h1 id=&#34;criteria&#34;&gt;Criteria&lt;/h1&gt;&#xA;&lt;p&gt;I look for tools that are useful for me and my clients. That is, they&#xA;can help create apps of various kinds, for startups and the like.&lt;/p&gt;&#xA;&lt;p&gt;More specialized tools are interesting if they help create things that&#xA;entrepreneurs often want to create. E.g. with Sharetribe you can create&#xA;a marketplaces, where some sell and others buy, and that is something&#xA;many people want to do.&lt;/p&gt;&#xA;&lt;p&gt;Several things disqualify many tools at straight away:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Price: Either too expensive for a typical startup project or high&#xA;price per end user.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Designed for large companies and their needs. Often related to price,&#xA;but also what these tools are good and bad at.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Specialized in the &amp;quot;wrong&amp;quot; niche. E.g. there are many tools for&#xA;creating web forms and glorified spreadsheets (A la Airtable).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Too difficult to test out or to get started with.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Made for developers, for faster development, but requires programming.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;While things that are a pluss, and the generalist tools should have:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Storage of data (some kind of database)&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Logic required to create apps (If A then B..)&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Many users: Support for creating a user, logging in etc&#xA;(authentication)&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Many users: Not everyone has access to the same things (authorization)&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Support for creating apps for mobile (native iOS / Android, and/or&#xA;progressive web apps)&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Here is the list of the ones I will test. Did I forget any? Anyone have&#xA;experience with one or more of these?&lt;/p&gt;&#xA;&lt;h1 id=&#34;on-the-to-try-out-list&#34;&gt;On the &amp;quot;to try out&amp;quot; list&lt;/h1&gt;&#xA;&lt;h2 id=&#34;generalist-all-purpose-platforms&#34;&gt;Generalist, &amp;quot;all purpose&amp;quot; platforms&lt;/h2&gt;&#xA;&lt;h3 id=&#34;adalohttpswwwadalocom&#34;&gt;&lt;a href=&#34;https://www.adalo.com/&#34;&gt;Adalo&lt;/a&gt;&lt;/h3&gt;&#xA;&lt;p&gt;Platform for creating web apps and mobile apps. I used Adalo about 4&#xA;years ago to make a prototype. Quite liked it.&lt;/p&gt;&#xA;&lt;p&gt;Price: From 0$ to 200$ per month. The most relevant plan costs 30$&#xA;per month, lets you use your own domain etc.&lt;/p&gt;&#xA;&lt;h3 id=&#34;bravo-studiohttpswwwbravostudioapp&#34;&gt;&lt;a href=&#34;https://www.bravostudio.app&#34;&gt;Bravo Studio&lt;/a&gt;&lt;/h3&gt;&#xA;&lt;p&gt;From Figma design to a native mobile app.&lt;/p&gt;&#xA;&lt;p&gt;Price: From 0$ per to 118$ per month. The 2 most relevant plans costs&#xA;21$ and 118$ per month. The expensive one is required to remove the&#xA;Bravo logo/branding.&lt;/p&gt;&#xA;&lt;h3 id=&#34;bubblehttpsbubbleio&#34;&gt;&lt;a href=&#34;https://bubble.io/&#34;&gt;Bubble&lt;/a&gt;&lt;/h3&gt;&#xA;&lt;p&gt;One of the oldest and best-known platforms for creating web apps. I&#xA;tried it out about 4 years ago, with somewhat mixed results.&lt;/p&gt;&#xA;&lt;p&gt;Price: From 0$ to 399$ per month. The most relevant plan costs 32$&#xA;per month, lets you use your own domain etc..&lt;/p&gt;&#xA;&lt;h3 id=&#34;budibasehttpsbudibasecom&#34;&gt;&lt;a href=&#34;https://budibase.com&#34;&gt;Budibase&lt;/a&gt;&lt;/h3&gt;&#xA;&lt;p&gt;Price: 5$ per user per month?&lt;/p&gt;&#xA;&lt;p&gt;Open source?&lt;/p&gt;&#xA;&lt;h3 id=&#34;flutterflowhttpsflutterflowio&#34;&gt;&lt;a href=&#34;https://flutterflow.io/&#34;&gt;FlutterFlow&lt;/a&gt;&lt;/h3&gt;&#xA;&lt;p&gt;Price: 0 - 70$ per month.&lt;/p&gt;&#xA;&lt;h3 id=&#34;glidehttpsglideappscom&#34;&gt;&lt;a href=&#34;https://glideapps.com/&#34;&gt;Glide&lt;/a&gt;&lt;/h3&gt;&#xA;&lt;p&gt;Possibly a bit too &amp;quot;enterprisy&amp;quot; for my use.&lt;/p&gt;&#xA;&lt;p&gt;Price: 2 price models: &amp;quot;For Makers&amp;quot; and &amp;quot;For companies&amp;quot;. Maker is&#xA;probably the most relevant and costs 60$ per month (?). Although it&#xA;seems like it has fewer data sources than the &amp;quot;for companies&amp;quot; one.&lt;/p&gt;&#xA;&lt;h3 id=&#34;google-appsheethttpsaboutappsheetcomhome&#34;&gt;&lt;a href=&#34;https://about.appsheet.com/home/&#34;&gt;Google Appsheet&lt;/a&gt;&lt;/h3&gt;&#xA;&lt;p&gt;Looks pretty versatile. Probably good integration with the rest of&#xA;Google Workspace (Google Docs etc). Maybe a little limited?&lt;/p&gt;&#xA;&lt;p&gt;Price: A bit unclear. 10$ per user per month? More if you want AI&#xA;integration? Some of it included a Google Workspace subscription?&lt;/p&gt;&#xA;&lt;h3 id=&#34;jetadminhttpswwwjetadminio&#34;&gt;&lt;a href=&#34;https://www.jetadmin.io/&#34;&gt;jetAdmin&lt;/a&gt;&lt;/h3&gt;&#xA;&lt;p&gt;Price: From 49$ per month, 349$ to use your own domain.&lt;/p&gt;&#xA;&lt;h3 id=&#34;plasmichttpswwwplasmicapp&#34;&gt;&lt;a href=&#34;https://www.plasmic.app/&#34;&gt;Plasmic&lt;/a&gt;&lt;/h3&gt;&#xA;&lt;p&gt;Open source. Mostly focused on design and visuals. Maybe a little too&#xA;simple?&lt;/p&gt;&#xA;&lt;p&gt;Price: From 0$ to 499$. The most relevant plan, to remove the Plasmic&#xA;logo, costs $49 per month.&lt;/p&gt;&#xA;&lt;p&gt;Open source, so you can use it for free, with all functionality etc?&lt;/p&gt;&#xA;&lt;h3 id=&#34;toddlehttpstoddledev&#34;&gt;&lt;a href=&#34;https://toddle.dev&#34;&gt;toddle&lt;/a&gt;&lt;/h3&gt;&#xA;&lt;p&gt;Quite new. Norwegian? Danish?&lt;/p&gt;&#xA;&lt;p&gt;Price: Actually looks quite cheap, but what does 20$ per user mean?&lt;/p&gt;&#xA;&lt;h3 id=&#34;wewebhttpswewebio&#34;&gt;&lt;a href=&#34;https://weweb.io&#34;&gt;WeWeb&lt;/a&gt;&lt;/h3&gt;&#xA;&lt;p&gt;WeWeb is a &amp;quot;front end builder&amp;quot; that is used with another back-end&#xA;solution of some kind. For me it would perhaps be appropriate to code a&#xA;back-end myself. But there are also pure no-code back-end solutions such&#xA;as Xano. Maybe &lt;a href=&#34;https://pocketbase.io/&#34;&gt;Pocketbase&lt;/a&gt; could work as well.&lt;/p&gt;&#xA;&lt;p&gt;Price: From 0$ to 179$ per month. 49$ per month to use your own&#xA;domain. 179$ for more advanced functionality.&lt;/p&gt;&#xA;&lt;p&gt;Plus the price of a back-end system.&lt;/p&gt;&#xA;&lt;h3 id=&#34;wizedhttpswwwwizedcom&#34;&gt;&lt;a href=&#34;https://www.wized.com&#34;&gt;Wized&lt;/a&gt;&lt;/h3&gt;&#xA;&lt;p&gt;Wized works together with Webflow to let you make more advanced websites&#xA;and web apps than you can with Webflow alone. Looks good. Perhaps most&#xA;relevant if you already know Webflow?&lt;/p&gt;&#xA;&lt;p&gt;Price: From 0$ to 169$ per month. 12$ per month to use your own&#xA;domain.&lt;/p&gt;&#xA;&lt;p&gt;Plus you have to pay for Webflow in addition?&lt;/p&gt;&#xA;&lt;h3 id=&#34;xanohttpswwwxanocom&#34;&gt;&lt;a href=&#34;https://www.xano.com&#34;&gt;Xano&lt;/a&gt;&lt;/h3&gt;&#xA;&lt;p&gt;Xano is a little different because it is only a backend system. Most&#xA;no-code tools have both a &amp;quot;front end&amp;quot; and a &amp;quot;back end&amp;quot; that work&#xA;together. This means that Xano alone is not enough, and must be used&#xA;together with e.g. WeWeb.&lt;/p&gt;&#xA;&lt;p&gt;Personally, I would have tested &lt;a href=&#34;https://pocketbase.io/&#34;&gt;Pocketbase&lt;/a&gt; at&#xA;the same time as Xano, since it is open source and setting up a small&#xA;server is something I&#39;m comfortable with.&lt;/p&gt;&#xA;&lt;p&gt;Price: From 0$ to 225$ per month. The most relevant plan costs $99,&#xA;but I think you can go a long way with the free plan.&lt;/p&gt;&#xA;&lt;p&gt;Plus the price of a front-end system.&lt;/p&gt;&#xA;&lt;h2 id=&#34;specialized&#34;&gt;Specialized&lt;/h2&gt;&#xA;&lt;h3 id=&#34;sharetribehttpswwwsharetribecom&#34;&gt;&lt;a href=&#34;https://www.sharetribe.com/&#34;&gt;Sharetribe&lt;/a&gt;&lt;/h3&gt;&#xA;&lt;p&gt;A platform for creating marketplaces, that is, a place where someone&#xA;sells something and someone buys. Such as Craigslist and Airbnb. But you&#xA;can also sell for example something by the hour.&lt;/p&gt;&#xA;&lt;p&gt;Price: From 29$ to 249$ per month.&lt;/p&gt;&#xA;&lt;h3 id=&#34;figma-plugin-for-generating-codehttpswwwfigmacomcommunityplugin842128343887142055figma-to-code-html-tailwind-flutter-swiftui&#34;&gt;&lt;a href=&#34;https://www.figma.com/community/plugin/842128343887142055/figma-to-code-html-tailwind-flutter-swiftui&#34;&gt;Figma plugin for generating code&lt;/a&gt;&lt;/h3&gt;&#xA;&lt;p&gt;&amp;quot;Figma to Code&amp;quot; is a plugin for the design tool Figma. It is one of&#xA;many such tools for creating code from designs in Figma. Supports html&#xA;and css (with Tailwind), Flutter and SwiftUI.&lt;/p&gt;&#xA;&lt;p&gt;Alone, this is not a &amp;quot;no-code&amp;quot; tool. But there are several AI tools&#xA;that support creating designs in Figma for you (see below).&lt;/p&gt;&#xA;&lt;p&gt;Price: Appears to be free to use and &lt;a href=&#34;https://github.com/bernaferrari/FigmaToCode&#34;&gt;Open&#xA;source&lt;/a&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;generative-ai&#34;&gt;Generative AI&lt;/h2&gt;&#xA;&lt;p&gt;These are a little different. With the exception of Buzzy, they&#xA;typically only create a design (UI) and perhaps code to implement the&#xA;design (html and css).&lt;/p&gt;&#xA;&lt;p&gt;You cannot create a full web app or mobile app in most of these tools.&lt;/p&gt;&#xA;&lt;p&gt;But using generative AI can save us so much time that it&#39;s worth&#xA;testing.&lt;/p&gt;&#xA;&lt;p&gt;I&#39;m guessing the UI&#39;s most of these create are pretty generic, and not&#xA;as good as a good designer could have made. So they may not be good&#xA;enough if your app is to stand out from the crowd with especially good&#xA;design and UI.&lt;/p&gt;&#xA;&lt;h3 id=&#34;buzzyhttpswwwbuzzybuzz&#34;&gt;&lt;a href=&#34;https://www.buzzy.buzz/&#34;&gt;Buzzy&lt;/a&gt;&lt;/h3&gt;&#xA;&lt;p&gt;Looks good, certainly one of the most promising on this list. When using&#xA;chat (a text description), it creates a UI for you. After giving you a&#xA;change to change the UI in Figma, Buzzy should in theory be able to&#xA;create a working web or mobile app.&lt;/p&gt;&#xA;&lt;p&gt;Buzzy is one of the few AI/AI tools that does more than create a design&#xA;and/or html and css.&lt;/p&gt;&#xA;&lt;p&gt;Price: Not entirely obvious, but it seems that you can now pay 50$ per&#xA;month to generate UI (and code?). Whereas if you want them to &amp;quot;host&amp;quot;&#xA;the web app (make it available to users) it costs $600 for a year.&lt;/p&gt;&#xA;&lt;p&gt;No free trial.&lt;/p&gt;&#xA;&lt;p&gt;See &lt;a href=&#34;https://www.buzzy.buzz/special-offers&#34;&gt;Special offers&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;galileohttpswwwusegalileoai&#34;&gt;&lt;a href=&#34;https://www.usegalileo.ai&#34;&gt;Galileo&lt;/a&gt;&lt;/h3&gt;&#xA;&lt;p&gt;When using chat (a text description), it creates a UI for you. The&#xA;result is a design in Figma. Unsure if it can also create code to&#xA;implement the design. If not, you can probably use the Figma plugin&#xA;mentioned above.&lt;/p&gt;&#xA;&lt;p&gt;Price: 19$ per month, but everyone can see what you create. 39$ for&#xA;&amp;quot;private mode&amp;quot;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;renditionhttpstryrenditioncom&#34;&gt;&lt;a href=&#34;https://tryrendition.com&#34;&gt;Rendition&lt;/a&gt;&lt;/h3&gt;&#xA;&lt;p&gt;Rendition is actually two different things:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://renditioncreate.com/&#34;&gt;Rendition Create&lt;/a&gt;: Create a design&#xA;based on chat and either export it to Figma or create code to&#xA;implement it (html and css with Tailwind).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://www.figma.com/community/plugin/1031998871372194709/Rendition%3A-Figma-%3EReact-in-one-click&#34;&gt;Rendition from&#xA;Figma&lt;/a&gt;:&#xA;Take a design in Figma and create code to implement it (html and css&#xA;with Tailwind). (Could not get this work last time I tried).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;You can test it for free.&lt;/p&gt;&#xA;&lt;p&gt;Price:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Renedition Create: Not sure, 10$ per month?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Rendition form Figma: Free to use a bit, then 10$ per month for more&#xA;use.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;uizardhttpsuizardio&#34;&gt;&lt;a href=&#34;https://uizard.io&#34;&gt;Uizard&lt;/a&gt;&lt;/h3&gt;&#xA;&lt;p&gt;Generate design and UI with chat or from a screenshot or wireframe.&lt;/p&gt;&#xA;&lt;p&gt;Can also create some code (html, css and React code).&lt;/p&gt;&#xA;&lt;p&gt;Seems to have a lot of functionality for creating and editing UIs. So&#xA;it&#39;s also a simpler alternative to Figma.&lt;/p&gt;&#xA;&lt;p&gt;Price: From 0$ to 49$ per month.&lt;/p&gt;&#xA;&lt;h3 id=&#34;vercel-v0httpsv0dev&#34;&gt;&lt;a href=&#34;https://v0.dev/&#34;&gt;Vercel v0&lt;/a&gt;&lt;/h3&gt;&#xA;&lt;p&gt;Vercel v0 is similar to Galileo. When using chat (a text description),&#xA;it creates a UI for you. v0 creates code to implement the design (html,&#xA;css with Tailwind and React).&lt;/p&gt;&#xA;&lt;p&gt;v0 cannot export to Figma and is perhaps more &amp;quot;tied&amp;quot; to React than the&#xA;other similar tools?&lt;/p&gt;&#xA;&lt;p&gt;Price: From 0$ per month, but everyone can see what you create. For&#xA;$20 per month you get to enjoy what it makes and also &amp;quot;High Quality&amp;quot;,&#xA;whatever that means.&lt;/p&gt;&#xA;&lt;h1 id=&#34;discared&#34;&gt;Discared&lt;/h1&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://Appfarm.io&#34;&gt;Appfarm&lt;/a&gt;&lt;br&gt;&#xA;Very curious about Appfarm and want to check it out.&lt;/p&gt;&#xA;&lt;p&gt;But in general it is probably too expensive for my use, typically&#xA;1000-2000$ per month, if I understood it correctly.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://genus.co/&#34;&gt;Genus&lt;/a&gt;&lt;br&gt;&#xA;Too &amp;quot;enterprisy&amp;quot;. Norwegian, large customers, have been doing this for&#xA;a while.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://hadron.app&#34;&gt;Hadron&lt;/a&gt;&lt;br&gt;&#xA;Design. Creates html and css for you?&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://interplayapp.com&#34;&gt;Interplay&lt;/a&gt;&lt;br&gt;&#xA;Design heavy: React components and design tokens.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://kombai.com&#34;&gt;Kombai&lt;/a&gt;&lt;br&gt;&#xA;Design for React, html and css. Requires coding?&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://www.getmotoradmin.com/&#34;&gt;Motor Admin.com&lt;/a&gt;&lt;br&gt;&#xA;Similar to Airtable (spreadsheet style)&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://nocodb.com/&#34;&gt;nocodb&lt;/a&gt;{.com}&lt;br&gt;&#xA;Similar to Airtable (spreadsheet style)&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://www.outsystems.com/&#34;&gt;OutSystems&lt;/a&gt;&lt;br&gt;&#xA;Too expensive, starting at $1,513 (USD) per month.&lt;/p&gt;&#xA;&lt;p&gt;Looks good, logic, mobile apps etc&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://createwithplay.com&#34;&gt;Play&lt;/a&gt;&lt;br&gt;&#xA;Looks good, but only for ios apps&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://retool.com/&#34;&gt;Retool&lt;/a&gt;&lt;br&gt;&#xA;For &amp;quot;business applications&amp;quot;, pay per customer&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://rnbw.company&#34;&gt;RNBW&lt;/a&gt;&lt;br&gt;&#xA;Design. Creates html and css for you?&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://www.stackerhq.com/&#34;&gt;Stacker&lt;/a&gt;&lt;br&gt;&#xA;For &amp;quot;business applications&amp;quot;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://news.ycombinator.com/item?id=39666865&#34;&gt;Teable&lt;/a&gt;&lt;br&gt;&#xA;Similar to Airtable (spreadsheet style). Open source.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://utopia.app/&#34;&gt;Utopia&lt;/a&gt;&lt;br&gt;&#xA;For React, requires coding?&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://vizro.readthedocs.io/en/stable/&#34;&gt;Vizro&lt;/a&gt;&lt;br&gt;&#xA;&amp;quot;Python enabled data visualization&amp;quot;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://webstudio.is/&#34;&gt;Webstudio&lt;/a&gt;&lt;br&gt;&#xA;Similar to Webflow, i.e. lacks &amp;quot;app&amp;quot; functionality. Open Source.&lt;/p&gt;&#xA;</content>
    <link href="https://oyvindsk.com/posts/nocode-and-ai-tools-for-prototyping" rel="alternate"></link>
    <summary type="html">Overview of many different No-code tools from 2024</summary>
    <author>
      <name>Øyvind Gerrard Skaar</name>
      <email>hello@oyvindsk.com</email>
    </author>
  </entry>
  <entry>
    <title>How to use Google Cloud Storage with Golang</title>
    <updated>2016-10-26T00:00:00Z</updated>
    <id>tag:oyvindsk.com,2016-10-26:/posts/how-to-use-google-cloud-storage-with-golang</id>
    <content type="html">&lt;p&gt;&lt;img src=&#34;/static/posts/gcs-and-go.png&#34; alt=&#34;&#34;&gt;&lt;/p&gt;&#xA;&lt;p&gt;I recently had the &amp;quot;pleasure&amp;quot; of getting started with Google Cloud&#xA;Storage using Go. It was a hassle, but all&#39;s well that ends well.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Google Cloud Storage&lt;/strong&gt;, Storage or GCS for short, is a S3 like service&#xA;from Google. It lets you store files and other &amp;quot;blob&amp;quot; data cheaply and&#xA;easily. These files can be private or something you share with the&#xA;world. With public files, Google will cache them automatically to make&#xA;fetching them faster around the world. See &lt;a href=&#34;https://cloud.google.com/storage/&#34;&gt;the official Storage&#xA;page&lt;/a&gt; for a longer salespitch.&lt;/p&gt;&#xA;&lt;p&gt;Storage is a part of the overall Google Cloud Platform that also&#xA;includes things like Compute Engine and App Engine (comes in two&#xA;flavours: Standard and Flexible). See &lt;a href=&#34;https://cloud.google.com/&#34;&gt;the Google Cloud Platform&#xA;homepage&lt;/a&gt; for more.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Go&lt;/strong&gt; (or golang if you want) is an open source programming language&#xA;started by some guys at Google and now used by many people for many&#xA;different things. It&#39;s seen most success within newer, devops like,&#xA;serverside tools such as Docker, Kubernetes and Consul. This is not the&#xA;only usecase though, as it&#39;s a general purpose language with many strong&#xA;points. I currently use it to build back-end systems that talk http,&#xA;http/2 and websockets with mobile app&#39;s, JS frontends, special hardware&#xA;etc.&lt;/p&gt;&#xA;&lt;h1 id=&#34;digression-a-short-google-cloud-platform-rant&#34;&gt;Digression: A short Google Cloud Platform rant&lt;/h1&gt;&#xA;&lt;p&gt;Before we get to the point, I have to rant a little about the Google&#xA;Cloud Platform (GCP). In many ways I&#39;m a fan. It seems like they&#xA;understand &amp;quot;no ops&amp;quot; better than almost anybody, and in my opinion App&#xA;Engine could be the only real PaaS out there. Their pricing model is&#xA;very nice, with a linear increase in costs as the traffic increases&#xA;(quite unlike Heroku). With Compute Engine, their EC2-like IaaS, you get&#xA;automatic discounts when running a server for more than 25% of a month&#xA;(quite unlike Amazon&#39;s reserved instances). This means there&#39;s no need&#xA;to &amp;quot;reserve instances&amp;quot; up front. Just run a normal instance for enough&#xA;time and get automatic discounts. Great!&lt;/p&gt;&#xA;&lt;p&gt;So, there are many things to like about GCP, but obviously things are&#xA;not perfect. While the platform itself seems well-engineered, the&#xA;developer experience can be horrible at times. The learning curve is a&#xA;roller coaster, usually for stupid reasons.&lt;/p&gt;&#xA;&lt;p&gt;If you&#39;re in a hurry and you don&#39;t have anyone with GCP experience I&#xA;would probably recommend something else. That being said, developing on&#xA;GCP is fast and easy when you know how to do it. If you can avoid the&#xA;quirks and gotcha&#39;s, the platform itself in incredibly powerful.&lt;/p&gt;&#xA;&lt;p&gt;There&#39;s three main problems I&#39;ve seen so far:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The documentation falls into three categories: Correct, Outdated and&#xA;Just Plain Wrong. It sometimes feels like they are distributed evenly,&#xA;and therefore only correct 33% of the time, but that&#39;s probably just&#xA;me being negative.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;!-- raw HTML omitted --&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Related, there&#39;s usually 3 or 4 libraries to do something:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;1-2 legacy libraries that you are discouraged to use&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;1 new, but still in beta and missing some feature, library,&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;1 lib that&#39;s auto generated and probably works most of the time kind&#xA;of.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;(The documentation, of course, refers to one or all of these&#xA;seemingly at random).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;!-- raw HTML omitted --&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Quirks and gotchas in the different products. These are actually, for&#xA;the most part, documented and well known. They can still bite you&#xA;though if you&#39;re not careful.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;We&#39;ll see all these 3 in action here.&lt;/p&gt;&#xA;&lt;h1 id=&#34;cloud-storage-with-go&#34;&gt;Cloud Storage with Go&lt;/h1&gt;&#xA;&lt;p&gt;I did not start completely from scratch. I already knew Storage pretty&#xA;well having done something similar with Storage, App Engine Standard and&#xA;Python.&lt;/p&gt;&#xA;&lt;p&gt;The question therefore, when starting out, where something like:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;When developing on App Engine Standard (AE) you usually run it on your&#xA;own machine first. The AE tooling helps to simulate some of the AE and&#xA;Google Cloud Platform services locally. Can these tools simulate&#xA;Storage locally? This would be useful when writing and testing new&#xA;code.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;!-- raw HTML omitted --&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Which of the many libraries should I use? Do I need more than one?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;!-- raw HTML omitted --&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I&#39;m working with private (not public) files. How is authentication&#xA;handled?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;These questions answered, in order:&lt;/p&gt;&#xA;&lt;h2 id=&#34;can-you-simulate-storage-locally&#34;&gt;Can you simulate Storage locally?&lt;/h2&gt;&#xA;&lt;p&gt;The short answer: No you can not. Use one or more buckets just for&#xA;testing.&lt;/p&gt;&#xA;&lt;p&gt;What most people end up doing is to have 1 or more Storage buckets just&#xA;for development. This actually works pretty well when you get&#xA;authentication working (quite easy, more on that later). You have to pay&#xA;for the traffic you upload and download when testing, but the price is&#xA;so low that it&#39;s just a rounding error for most usecases. Of course, if&#xA;your files are very large uploading them could take some time. On the&#xA;other hand, you probably have to upload them sooner or later anyway. And&#xA;having them in the real Storage makes them accessible to the rest of the&#xA;Google Cloud Platform, most of which integrates nicely with Storage.&lt;/p&gt;&#xA;&lt;p&gt;The App Engine Standard tooling includes support for something called&#xA;&amp;quot;Blobstore&amp;quot; which is the AE specific predecessor to Storage. It has some&#xA;limited interoperability with Storage: You can tell it to actually store&#xA;the files in Storage instead of in the old blobstore. I haven&#39;t tried&#xA;this as I can&#39;t really see any of my projects staying with just the&#xA;Blobstore for very long. Storage integrates with the rest of the Google&#xA;Cloud, has many extra features and keeps evolving.&lt;/p&gt;&#xA;&lt;h2 id=&#34;which-go-library-should-you-use-with-storage&#34;&gt;Which Go library should you use with Storage?&lt;/h2&gt;&#xA;&lt;p&gt;The short answer: Use the new gcloud Go libs: &lt;a href=&#34;https://code.googlesource.com/gocloud&#34;&gt;Main&#xA;page&lt;/a&gt; / &lt;a href=&#34;https://godoc.org/cloud.google.com/go/storage&#34;&gt;Storage client&#xA;docs&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;This is the newest library and even though it&#39;s marked with &amp;quot;beta&amp;quot; it&#xA;seems stable enough that people use it in production.&lt;/p&gt;&#xA;&lt;p&gt;Here are the different libraries I&#39;ve found so far:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://godoc.org/cloud.google.com/go/storage&#34;&gt;cloud.google com/go/storage&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://godoc.org/google.golang.org/cloud/storage&#34;&gt;google.golang org/cloud/storage&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://code.googlesource.com/gocloud-legacy/&#34;&gt;code.googlesource com/gocloud-legacy&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://github.com/google/google-api-go-client&#34;&gt;github.com/google/google-api-go-client&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;See what I meant in my rant? I probably even forgot a couple..&lt;/p&gt;&#xA;&lt;h2 id=&#34;how-do-you-authenticate-to-the-real-storage-when-running-locally&#34;&gt;How do you authenticate to the &amp;quot;real&amp;quot; Storage when running locally?&lt;/h2&gt;&#xA;&lt;p&gt;The short answer: Use the gcloud lib mentioned above. Install the gcloud&#xA;client program if you haven&#39;t already (not related to the gcloud lib,&#xA;confusing eh? =)&lt;/p&gt;&#xA;&lt;p&gt;Run:&lt;/p&gt;&#xA;&lt;pre class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;gcloud beta auth application-default login&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;on the command line and log in with your Google account.&lt;/p&gt;&#xA;&lt;p&gt;After reading and googling this stuff for a while I was under the&#xA;impression that this was more complicated. The above methods uses the&#xA;developers Google account to authenticate with Storage. This is useful&#xA;when running locally, but is a bad fit in some situations. You may want&#xA;the program or machine to authenticate instead of the developer, for&#xA;example when running automated tests. Therefore there are other ways of&#xA;authenticating, mainly using Key files and something called Service&#xA;Account&#39;s.&lt;/p&gt;&#xA;&lt;p&gt;I haven&#39;t tried this in Go, but the process seems to be:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Generate and download a key from the Cloud Console. You can use an&#xA;existing Service Account or create a new one. You find this under IAM&#xA;&amp;amp; Admin ⇒ Service Accounts.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;!-- raw HTML omitted --&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Pass this keyfile to the gcloud library like this:&lt;/p&gt;&#xA;&lt;pre class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nx&#34;&gt;client&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;err&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;:=&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;storage&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nf&#34;&gt;NewClient&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;ctx&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;option&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nf&#34;&gt;WithServiceAccountFile&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s&#34;&gt;&amp;#34;path/to/keyfile.json&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;))&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;All that is not necessary to just run code locally against the real&#xA;Storage. Contrary to the common wisdom (at the time of writing), the&#xA;helper gcloud command above (gcloud beta auth application-default&#xA;login) actually works. This makes using the gcloud library a breeze,&#xA;just do:&lt;/p&gt;&#xA;&lt;pre class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nx&#34;&gt;client&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;err&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;:=&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;storage&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nf&#34;&gt;NewClient&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;ctx&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;).&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;When running on the Google Cloud Platform the same code just works and&#xA;you should not have to think too much about authentication and&#xA;authorization in common scenarios.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;One last tip: I could not get auto-detecting of the bucketname, as seen&#xA;in the docs, to work. This confused me for a long time since it doesn&#39;t&#xA;throw an error, it just returns an invalid bucketname.&lt;/p&gt;&#xA;&lt;p&gt;Hopefully this is useful for someone. It took me hours to figure out,&#xA;but it&#39;s pretty simple and straight-forward when you know how to do it&#xA;=).&lt;/p&gt;&#xA;</content>
    <link href="https://oyvindsk.com/posts/how-to-use-google-cloud-storage-with-golang" rel="alternate"></link>
    <summary type="html">Google Cloud Storage, Storage or GCS for short, is a S3 like service from Google. It lets you store files and other “blob” data cheaply and easily</summary>
    <author>
      <name>Øyvind Gerrard Skaar</name>
      <email>hello@oyvindsk.com</email>
    </author>
  </entry>
  <entry>
    <title>Learn from my Go mistakes, Part 1: Closing over loop variables</title>
    <updated>2016-05-11T00:00:00Z</updated>
    <id>tag:oyvindsk.com,2016-05-11:/posts/common-golang-mistakes-1</id>
    <content type="html">&lt;p&gt;&lt;img src=&#34;/static/posts/gopher-fail.jpg&#34; alt=&#34;&#34;&gt;&lt;/p&gt;&#xA;&lt;p&gt;This post is about a mistake that&#39;s common and easy to make in Golang. I&#xA;show a few examples, explain why it happens and how you can avoid it.&#xA;This is explained in many places already (see links at the end). My goal&#xA;is to be more thorough than the others.&lt;/p&gt;&#xA;&lt;p&gt;There might be many of these blogposts. There&#39;s at least one more topic&#xA;I want to write about. We&#39;ll see.&lt;/p&gt;&#xA;&lt;h1 id=&#34;closing-over-a-loop-variable&#34;&gt;Closing over a loop variable&lt;/h1&gt;&#xA;&lt;p&gt;This mistake is very easy to make in some situations. If you please,&#xA;take a look at the code below and try to figure out why Example B fails.&lt;/p&gt;&#xA;&lt;p&gt;(Most code snipet has a link in the header to the Go Playground where&#xA;you can run and play with the code. All links open in this window).&lt;/p&gt;&#xA;&lt;p&gt;Print out the numbers from 0 to 2:&lt;/p&gt;&#xA;&lt;p&gt;(&lt;a href=&#34;https://play.golang.org/p/NJhdSw-sSC&#34;&gt;On the playgroud&lt;/a&gt;)&lt;/p&gt;&#xA;&lt;pre class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;kn&#34;&gt;package&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;main&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;kn&#34;&gt;import&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;    &lt;/span&gt;&lt;span class=&#34;s&#34;&gt;&amp;#34;fmt&amp;#34;&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;    &lt;/span&gt;&lt;span class=&#34;s&#34;&gt;&amp;#34;time&amp;#34;&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;kd&#34;&gt;func&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;nf&#34;&gt;main&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;()&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;    &lt;/span&gt;&lt;span class=&#34;c1&#34;&gt;// A&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;    &lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;fmt&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nf&#34;&gt;Println&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s&#34;&gt;&amp;#34;Example A - Count to 2, This works :) &amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;    &lt;/span&gt;&lt;span class=&#34;k&#34;&gt;for&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;a&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;:=&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;0&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;a&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;p&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;3&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;a&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;++&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;        &lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;fmt&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nf&#34;&gt;Println&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s&#34;&gt;&amp;#34;a is:&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;a&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;    &lt;/span&gt;&lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;    &lt;/span&gt;&lt;span class=&#34;c1&#34;&gt;// B&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;    &lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;fmt&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nf&#34;&gt;Println&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s&#34;&gt;&amp;#34;\n\nExample B - Count to 2, concurrently.&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;    &lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;fmt&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nf&#34;&gt;Println&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s&#34;&gt;&amp;#34;This does not work :( &amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;    &lt;/span&gt;&lt;span class=&#34;k&#34;&gt;for&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;b&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;:=&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;0&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;b&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;p&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;3&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;b&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;++&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;        &lt;/span&gt;&lt;span class=&#34;c1&#34;&gt;// Run fmt.Println(..) in the background&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;        &lt;/span&gt;&lt;span class=&#34;k&#34;&gt;go&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;kd&#34;&gt;func&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;()&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;            &lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;fmt&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nf&#34;&gt;Println&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s&#34;&gt;&amp;#34;b is:&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;b&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;        &lt;/span&gt;&lt;span class=&#34;p&#34;&gt;}()&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;    &lt;/span&gt;&lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;    &lt;/span&gt;&lt;span class=&#34;c1&#34;&gt;// we sleep to let the go functions finish before the program quits&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;    &lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;time&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nf&#34;&gt;Sleep&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;2&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;*&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;time&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;Second&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Running the above code prints:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;Example A - Count to 2, This works :) &#xA;a is: 0&#xA;a is: 1&#xA;a is: 2&#xA;&#xA;&#xA;Example B - Count to 2, concurrently.&#xA;This does not work :( &#xA;b is: 3&#xA;b is: 3&#xA;b is: 3&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Huh? 3, 3, 3? Where&#39;s zero and one? And wasn&#39;t it suppose to stop at&#xA;two? Bah! We can&#39;t even count to 2, what&#39;s going on? Two things:&lt;/p&gt;&#xA;&lt;h2 id=&#34;closures&#34;&gt;Closures&lt;/h2&gt;&#xA;&lt;p&gt;Firstly, when we print variable &#39;b&#39; in Example B what are we even&#xA;referring to? It&#39;s inside of a function, and there&#39;s no variable &#39;b&#39;&#xA;inside this function body. If you did this in a normal function you&#xA;would get a nice little error from the compiler complaining that there&#39;s&#xA;no &#39;b&#39;.&lt;/p&gt;&#xA;&lt;p&gt;This does not happen here. The function we have in Example B,&#xA;&#39;func(){..}&#39;, is not a normal function: it&#39;s in the middle of another&#xA;one and it lacks a name. These types of functions are often call&#xA;&lt;em&gt;function literals&lt;/em&gt; or &lt;em&gt;anonymous functions&lt;/em&gt;. I like &amp;quot;anonymous&#xA;functions&amp;quot;. An anonymous function can &amp;quot;see&amp;quot; variables from the&#xA;function it&#39;s inside (enclosed in). That means that in our example it&#xA;can access variable &#39;b&#39;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&#34;/static/posts/gopher-fail-1-example-b.png&#34; alt=&#34;&#34;&gt;&lt;/p&gt;&#xA;&lt;p&gt;This is not a bug in Go, by the way. It&#39;s intended behavior that can be&#xA;used to do some pretty advanced stuff. See the &amp;quot;function closures&amp;quot;&#xA;links at the end.&lt;/p&gt;&#xA;&lt;h2 id=&#34;variable-reuse&#34;&gt;Variable reuse&lt;/h2&gt;&#xA;&lt;p&gt;Our anonymous function can access variable &#39;b&#39;. But it&#39;s the same&#xA;variable &#39;b&#39;, accessed 3 time in the loop. It&#39;s declared once before the&#xA;loop starts to run. It then changes value from 0 to 1, then to 2 and&#xA;finally to 3. Then the loop stops since 3 is not less than 3.&lt;/p&gt;&#xA;&lt;h2 id=&#34;goroutines-runs-out-of-order&#34;&gt;Goroutines runs out of order&lt;/h2&gt;&#xA;&lt;p&gt;With our &#39;go func()..&#39; statement we start a new goroutine. They run&#xA;concurrently, which they do not run one after the other in an orderly&#xA;fashion. They could in theory run one after the other, or they could all&#xA;run at the same time (in parallel). Or maybe the &amp;quot;last one&amp;quot; runs first&#xA;and then the &amp;quot;first one&amp;quot; and the &amp;quot;second one&amp;quot; runs last, or maybe..&#xA;think you get the point; it&#39;s unpredictable. Well this is kind of the&#xA;point of using Goroutines in the first place. We want to be able to run&#xA;many things at once. In this example it does not make a lot of sense,&#xA;but imagine, if you will, that the printing took 10 seconds. Or we did&#xA;something else that took 10 seconds. In that case Example A would take&#xA;30 seconds to complete and Example B would only take 10 seconds. Great!&lt;/p&gt;&#xA;&lt;p&gt;We can think of the go statement as &amp;quot;run this code in the background at&#xA;some point&amp;quot;. It could run right away, or it could run later. Thinking&#xA;like this it becomes more clear why Example B fails. It&#39;s possible,&#xA;likely even, that the loop finishes before the first &#39;fmt.Println(&amp;quot;b&#xA;is:&amp;quot;, b)&#39; ever runs. So the loops runs, increasing &#39;b&#39; to 3 and then&#xA;stopping. &lt;strong&gt;Then&lt;/strong&gt; the goroutines run and print variable b. They all&#xA;look at the same variable b, the one declared at the start of the loop.&#xA;They never got their own copy. At this point &#39;b&#39; is 3, so they all print&#xA;3.&lt;/p&gt;&#xA;&lt;h1 id=&#34;fixing-it&#34;&gt;Fixing it&lt;/h1&gt;&#xA;&lt;p&gt;There are several ways to change our code and fix this bug. I&#39;ve listed&#xA;the 3 I could come up with at this time, with the last one possibly&#xA;being the most &amp;quot;idiomatic&amp;quot; go.&lt;/p&gt;&#xA;&lt;p&gt;Each of these examples should print something like this if you run them.&#xA;Note that the numbers can be out of order, since the goroutines can run&#xA;in any possible order, or all at once.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;Fix 2 for Example B&#xA;dd is: 1&#xA;dd is: 0&#xA;dd is: 2&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h2 id=&#34;alternative-1&#34;&gt;Alternative 1&lt;/h2&gt;&#xA;&lt;p&gt;One easy way of fixing this is to change the anonymous function to a&#xA;normal function call. Normal functions can not refer to variables&#xA;&amp;quot;outside&amp;quot; itself. This forces us to pass the variable we want to use&#xA;as an argument to the function (print() in our example). When you call a&#xA;normal function the arguments are copied, every time you call it. That&#xA;is, the value of &#39;c&#39; (0, 1 or 2) is copied and given to the invoked&#xA;function. Therefore this works as you would expect:&lt;/p&gt;&#xA;&lt;p&gt;(&lt;a href=&#34;https://play.golang.org/p/RuUUVeH1ZG&#34;&gt;On the playgroud&lt;/a&gt;)&lt;/p&gt;&#xA;&lt;pre class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;kn&#34;&gt;package&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;main&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;kn&#34;&gt;import&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;    &lt;/span&gt;&lt;span class=&#34;s&#34;&gt;&amp;#34;fmt&amp;#34;&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;    &lt;/span&gt;&lt;span class=&#34;s&#34;&gt;&amp;#34;time&amp;#34;&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;kd&#34;&gt;func&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;nf&#34;&gt;main&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;()&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;    &lt;/span&gt;&lt;span class=&#34;c1&#34;&gt;// Fix 1&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;    &lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;fmt&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nf&#34;&gt;Println&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s&#34;&gt;&amp;#34;\n\nFix 1 for Example B&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;    &lt;/span&gt;&lt;span class=&#34;k&#34;&gt;for&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;c&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;:=&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;0&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;c&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;p&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;3&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;c&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;++&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;        &lt;/span&gt;&lt;span class=&#34;c1&#34;&gt;// same code as earlier,&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;        &lt;/span&gt;&lt;span class=&#34;c1&#34;&gt;// but no longer in an anonymous function:&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;        &lt;/span&gt;&lt;span class=&#34;k&#34;&gt;go&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;nb&#34;&gt;print&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;c&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;        &lt;/span&gt;&lt;span class=&#34;c1&#34;&gt;// The value of c is copied when we call print()&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;        &lt;/span&gt;&lt;span class=&#34;c1&#34;&gt;//   so it&amp;#39;s no longer reffering to the same variable.&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;        &lt;/span&gt;&lt;span class=&#34;c1&#34;&gt;// This copying happens before the code&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;        &lt;/span&gt;&lt;span class=&#34;c1&#34;&gt;//   in print() actually runs&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;    &lt;/span&gt;&lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;    &lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;time&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nf&#34;&gt;Sleep&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;2&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;*&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;time&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;Second&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;kd&#34;&gt;func&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;nb&#34;&gt;print&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;c&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;kt&#34;&gt;int&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;    &lt;/span&gt;&lt;span class=&#34;c1&#34;&gt;// The value of c was copied.&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;    &lt;/span&gt;&lt;span class=&#34;c1&#34;&gt;// So &amp;#39;c&amp;#39; here is not the same as &amp;#39;c&amp;#39; in the for loop above.&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;    &lt;/span&gt;&lt;span class=&#34;c1&#34;&gt;// It&amp;#39;s a &amp;#34;coincidence&amp;#34; that they are both named c&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;    &lt;/span&gt;&lt;span class=&#34;c1&#34;&gt;// (it&amp;#39;s irrelevant).&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;    &lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;fmt&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nf&#34;&gt;Println&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s&#34;&gt;&amp;#34;c is:&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;c&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;alternative-2&#34;&gt;Alternative 2&lt;/h2&gt;&#xA;&lt;p&gt;But let&#39;s say you wanted to keep the anonymous function? They can&#xA;certainly be useful, creating a named function that is only used in one&#xA;place is kind of ugly. This code fixes this by explicitly copying the&#xA;variable before using it in the anonymous function. This works because&#xA;each run (iteration) through the loop now gets its own variable, with&#xA;its own value. So it does not matter when the goroutine actually runs.&#xA;It will refer to its own variable &#39;dd&#39; that never changes.&lt;/p&gt;&#xA;&lt;p&gt;(&lt;a href=&#34;https://play.golang.org/p/MDg7Pl0-E4&#34;&gt;On the playgroud&lt;/a&gt;)&lt;/p&gt;&#xA;&lt;pre class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;kn&#34;&gt;package&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;main&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;kn&#34;&gt;import&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;    &lt;/span&gt;&lt;span class=&#34;s&#34;&gt;&amp;#34;fmt&amp;#34;&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;    &lt;/span&gt;&lt;span class=&#34;s&#34;&gt;&amp;#34;time&amp;#34;&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;kd&#34;&gt;func&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;nf&#34;&gt;main&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;()&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;    &lt;/span&gt;&lt;span class=&#34;c1&#34;&gt;// Fix 2&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;    &lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;fmt&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nf&#34;&gt;Println&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s&#34;&gt;&amp;#34;Fix 2 for Example B&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;    &lt;/span&gt;&lt;span class=&#34;k&#34;&gt;for&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;d&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;:=&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;0&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;d&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;p&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;3&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;d&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;++&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;        &lt;/span&gt;&lt;span class=&#34;c1&#34;&gt;// The value of d is copied into its own variable. &lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;        &lt;/span&gt;&lt;span class=&#34;c1&#34;&gt;// This happens for every iteration in the loop.&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;        &lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;dd&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;:=&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;d&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;        &lt;/span&gt;&lt;span class=&#34;k&#34;&gt;go&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;kd&#34;&gt;func&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;()&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;            &lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;fmt&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nf&#34;&gt;Println&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s&#34;&gt;&amp;#34;dd is:&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;dd&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;        &lt;/span&gt;&lt;span class=&#34;p&#34;&gt;}()&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;    &lt;/span&gt;&lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;    &lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;time&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nf&#34;&gt;Sleep&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;2&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;*&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;time&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;Second&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;alternative-3&#34;&gt;Alternative 3&lt;/h2&gt;&#xA;&lt;p&gt;Finally this fix is similar to the first one (well, actually they&#39;re all&#xA;pretty similar). Here we also copy the variable for every iteration of&#xA;the &lt;strong&gt;for&lt;/strong&gt; loop. Our anonymous function still sees the variable &#39;e&#39; but&#xA;ignores it. Instead we send in the variable we want to access when we&#xA;call the anonymous function.&lt;/p&gt;&#xA;&lt;p&gt;Having both &#39;e&#39; and &#39;ee&#39; inside the function body can be a little&#xA;confusing. We could for example use variable &#39;e&#39; by mistake and the&#xA;compiler would not complain. Therefore some people prefer to name the&#xA;second variable the same as the first one (&#39;e&#39; instead of &#39;ee&#39; in our&#xA;example). This has the effect of hiding (shadowing) the first one and&#xA;thus making it inaccessible.&lt;/p&gt;&#xA;&lt;p&gt;(&lt;a href=&#34;https://play.golang.org/p/QO506H3qTz&#34;&gt;On the playgroud&lt;/a&gt;)&lt;/p&gt;&#xA;&lt;pre class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;kn&#34;&gt;package&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;main&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;kn&#34;&gt;import&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;    &lt;/span&gt;&lt;span class=&#34;s&#34;&gt;&amp;#34;fmt&amp;#34;&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;    &lt;/span&gt;&lt;span class=&#34;s&#34;&gt;&amp;#34;time&amp;#34;&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;kd&#34;&gt;func&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;nf&#34;&gt;main&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;()&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;    &lt;/span&gt;&lt;span class=&#34;c1&#34;&gt;// Fix 3&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;    &lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;fmt&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nf&#34;&gt;Println&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s&#34;&gt;&amp;#34;Fix 3 for Example B&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;    &lt;/span&gt;&lt;span class=&#34;k&#34;&gt;for&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;e&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;:=&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;0&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;e&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;p&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;3&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;e&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;++&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;        &lt;/span&gt;&lt;span class=&#34;k&#34;&gt;go&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;kd&#34;&gt;func&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;ee&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;kt&#34;&gt;int&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;            &lt;/span&gt;&lt;span class=&#34;c1&#34;&gt;// The value of e is copied into its own variable ee&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;            &lt;/span&gt;&lt;span class=&#34;c1&#34;&gt;// (We could also call this new variable e)&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;            &lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;fmt&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nf&#34;&gt;Println&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s&#34;&gt;&amp;#34;ee is:&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;ee&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;        &lt;/span&gt;&lt;span class=&#34;p&#34;&gt;}(&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;e&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;c1&#34;&gt;// e becomes ee inside the function&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;    &lt;/span&gt;&lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;    &lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;time&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nf&#34;&gt;Sleep&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;2&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;*&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;time&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;Second&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h1 id=&#34;thats-it&#34;&gt;That&#39;s it&lt;/h1&gt;&#xA;&lt;p&gt;Ok, that&#39;s it =) Hit me up on twitter&#xA;(&lt;a href=&#34;http://twitter.com/oyvindsk&#34;&gt;@oyvindsk&lt;/a&gt;) if you have any questions or&#xA;corrections. All honest feedback is welcome. You can also enter your&#xA;email underneath to get future articles.&lt;/p&gt;&#xA;&lt;h1 id=&#34;links&#34;&gt;Links&lt;/h1&gt;&#xA;&lt;h2 id=&#34;closures-in-go&#34;&gt;Closures in Go&lt;/h2&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://gobyexample.com/closures&#34;&gt;https://gobyexample.com/closures&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://tour.golang.org/moretypes/25&#34;&gt;https://tour.golang.org/moretypes/25&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;other&#34;&gt;Other&lt;/h2&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&#34;http://devs.cloudimmunity.com/gotchas-and-common-mistakes-in-go-golang/index.html#closure_for_it_vars&#34;&gt;Entry at the 50 shades of Go for this&#xA;gotcha&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;</content>
    <link href="https://oyvindsk.com/posts/common-golang-mistakes-1" rel="alternate"></link>
    <summary type="html">A few common Go mistakes</summary>
    <author>
      <name>Øyvind Gerrard Skaar</name>
      <email>hello@oyvindsk.com</email>
    </author>
  </entry>
  <entry>
    <title>A few places you can find Golang remote jobs</title>
    <updated>2016-04-15T00:00:00Z</updated>
    <id>tag:oyvindsk.com,2016-04-15:/posts/go-remote-jobs</id>
    <content type="html">&lt;p&gt;&lt;img src=&#34;https://blog.golang.org/gopher/usergroups.png&#34; alt=&#34;&#34;&gt;&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Go is an open source programming language that makes it easy to build&#xA;simple, reliable, and efficient software&lt;/p&gt;&#xA;&lt;p&gt;--- golang.org&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Go (or golang) is a simple, general purpose programming language that&#xA;excels at writing things like backend services. It&#39;s the language used&#xA;to make Docker, among many other things.&lt;/p&gt;&#xA;&lt;p&gt;I&#39;m currently using Golang almost exclusively and I&#39;m looking for remote&#xA;freelance jobs. I&#39;ve therefor compiled this list for my own sake, but I&#xA;guess it can be useful to others as well.&lt;/p&gt;&#xA;&lt;h1 id=&#34;websites-specifically-for-golang&#34;&gt;Websites specifically for Golang&lt;/h1&gt;&#xA;&lt;h2 id=&#34;we-love-golang&#34;&gt;We Love Golang&lt;/h2&gt;&#xA;&lt;p&gt;&lt;a href=&#34;http://www.welovegolang.com/jobs/search?q=remote&#34;&gt;http://www.welovegolang.com/jobs/search?q=remote&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;This is probably the site with the most Go specific listings. Many jobs&#xA;in Europe and the US. It seems like searching for &amp;quot;remote&amp;quot; is not&#xA;entirely reliable, so double check the results before getting too&#xA;excited about a job :). This site also has developer profiles, and you&#xA;can get listed just by tweeting them.&lt;/p&gt;&#xA;&lt;h2 id=&#34;golangprojectscom&#34;&gt;Golangprojects.com&lt;/h2&gt;&#xA;&lt;p&gt;&lt;a href=&#34;http://www.golangprojects.com/golang-remote-jobs.html&#34;&gt;&lt;a href=&#34;http://www.golangprojects.com/golang-remote-jobs.html&#34;&gt;http://www.golangprojects.com/golang-remote-jobs.html&lt;/a&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Also a good place to find Go-specific job listings. This site also have&#xA;developer profiles, but registering here is more work since they require&#xA;more information. Seems like most of the jobs are full time at the&#xA;moment. Remote jobs can sometimes be US-specific.&lt;/p&gt;&#xA;&lt;h1 id=&#34;websites-specifically-for-remote-jobs&#34;&gt;Websites specifically for remote jobs&lt;/h1&gt;&#xA;&lt;h2 id=&#34;remoteok&#34;&gt;RemoteOK&lt;/h2&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://remoteok.io/remote-golang-jobs&#34;&gt;&lt;a href=&#34;https://remoteok.io/remote-golang-jobs&#34;&gt;https://remoteok.io/remote-golang-jobs&lt;/a&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Great site with reposts jobs from other places. You can often click the&#xA;&amp;quot;Apply for job&amp;quot; to get to the website with the original listing.&lt;/p&gt;&#xA;&lt;h2 id=&#34;remotely-awesome-jobs&#34;&gt;Remotely Awesome Jobs&lt;/h2&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://www.remotelyawesomejobs.com/tags/golang?q=&#34;&gt;https://www.remotelyawesomejobs.com/tags/golang?q=&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Similar to the above, but fewer listings.&lt;/p&gt;&#xA;&lt;h2 id=&#34;flexjobscom&#34;&gt;FlexJobs.com&lt;/h2&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://www.flexjobs.com/search?search=golang&amp;amp;location=&#34;&gt;https://www.flexjobs.com/search?search=golang&amp;amp;amp;location=&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Remote / telecommute jobs site.&lt;/p&gt;&#xA;&lt;h2 id=&#34;jobspresso&#34;&gt;Jobspresso&lt;/h2&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://jobspresso.co/browsejobs/#s=1&#34;&gt;https://jobspresso.co/browsejobs/#s=1&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;There&#39;s a couple of listings here, try searching for &amp;quot;golang&amp;quot; or maybe&#xA;&amp;quot;go&amp;quot;.&lt;/p&gt;&#xA;&lt;h1 id=&#34;golang-forums-etc&#34;&gt;Golang Forums etc&lt;/h1&gt;&#xA;&lt;h2 id=&#34;gophers-slack-channel&#34;&gt;Gophers Slack channel&lt;/h2&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://gophers.slack.com/messages/golang-jobs/&#34;&gt;&lt;a href=&#34;https://gophers.slack.com/messages/golang-jobs/&#34;&gt;https://gophers.slack.com/messages/golang-jobs/&lt;/a&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The Gophers Slack is quite active and has a separate &amp;quot;Jobs&amp;quot; channel.&lt;/p&gt;&#xA;&lt;h2 id=&#34;the-golang-forum&#34;&gt;The Golang forum&lt;/h2&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://forum.golangbridge.org/c/jobs&#34;&gt;&lt;a href=&#34;https://forum.golangbridge.org/c/jobs&#34;&gt;https://forum.golangbridge.org/c/jobs&lt;/a&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;the-golang-jobs-google-community&#34;&gt;The Golang-Jobs Google+ Community&lt;/h2&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://plus.google.com/communities/116819843904802051830&#34;&gt;&lt;a href=&#34;https://plus.google.com/communities/116819843904802051830&#34;&gt;https://plus.google.com/communities/116819843904802051830&lt;/a&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Not super active, 2 postings in the four first months of 2016.&lt;/p&gt;&#xA;&lt;h2 id=&#34;hacker-news-monthly-postings&#34;&gt;Hacker News Monthly Postings&lt;/h2&gt;&#xA;&lt;p&gt;&lt;a href=&#34;http://hnhiring.me/&#34;&gt;&lt;a href=&#34;http://hnhiring.me/&#34;&gt;http://hnhiring.me/&lt;/a&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Hacker News has monthly &amp;quot;Ask HN: Who is hiring?&amp;quot; posts. This is an&#xA;easy interface view and search this posts, you can filter on words etc.&#xA;More geeky than most job listing sites =)&lt;/p&gt;&#xA;&lt;h1 id=&#34;general-job-listing-sites&#34;&gt;General job listing sites&lt;/h1&gt;&#xA;&lt;h2 id=&#34;angel-list&#34;&gt;Angel List&lt;/h2&gt;&#xA;&lt;p&gt;Startup jobs in the US and a few other places around the world. (No&#xA;search function?)&lt;/p&gt;&#xA;&lt;p&gt;Remote Jobs at Angel List:&#xA;&lt;a href=&#34;https://angel.co/job-collections/remote&#34;&gt;&lt;a href=&#34;https://angel.co/job-collections/remote&#34;&gt;https://angel.co/job-collections/remote&lt;/a&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Golang jobs at Angel List. Varies how much these emphasize Go.&#xA;&lt;a href=&#34;https://angel.co/golang/jobs&#34;&gt;&lt;a href=&#34;https://angel.co/golang/jobs&#34;&gt;https://angel.co/golang/jobs&lt;/a&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;stack-overflow-jobs&#34;&gt;Stack Overflow Jobs&lt;/h2&gt;&#xA;&lt;p&gt;Remote jobs tagged with golang: &lt;a href=&#34;http://stackoverflow.com/jobs?searchTerm=%5Bgolang%5D&amp;amp;allowsremote=true&#34;&gt;http://stackoverflow.com/jobs?searchTerm=[golang]&amp;amp;allowsremote=true&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Remote jobs containing the word &amp;quot;golang&amp;quot;:&#xA;&lt;a href=&#34;https://stackoverflow.com/jobs?searchTerm=golang&amp;amp;allowsremote=true&#34;&gt;https://stackoverflow.com/jobs?searchTerm=golang&amp;amp;allowsremote=true&lt;/a&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;monstercom&#34;&gt;Monster.com&lt;/h2&gt;&#xA;&lt;p&gt;I was supriesd to find a few hits for &amp;quot;golang&amp;quot; and &amp;quot;remote&amp;quot; on&#xA;Monster.com:&#xA;&lt;a href=&#34;http://jobs.monster.com/search/?q=golang&amp;amp;where=remote&#34;&gt;http://jobs.monster.com/search/?q=golang&amp;amp;amp;where=remote&lt;/a&gt;&lt;/p&gt;&#xA;&lt;h1 id=&#34;others-checked&#34;&gt;Others checked&lt;/h1&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;a href=&#34;https://remotecoder.io/&#34;&gt;Remotecoder&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;No Go jobs when I checked.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;a href=&#34;https://weworkremotely.com/jobs/search?term=golang&#34;&gt;WeWorkRemotely&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;No Go jobs when I checked.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;a href=&#34;http://www.workingnomads.co/&#34;&gt;Working Nomads&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;No Go jobs when I checked.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;a href=&#34;https://www.wfh.io/categories/1-remote-software-development/jobs&#34;&gt;Whf&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Hard to know for sure, but I could not find any Go jobs when I checked.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;a href=&#34;http://jobs.arcticstartup.com/&#34;&gt;Job listings at Artic Startup&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Startups in the nordics. No Go jobs when I checked.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;a href=&#34;https://www.toptal.com/&#34;&gt;Toptal&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;&amp;quot;Exclusive&amp;quot; site for freelancers. Don&#39;t know if there&#39;s demand for Go&#xA;programmers here, they don&#39;t list their openings. Last I checked (in&#xA;2014?) the onboarding process was very automated and not that great. You&#xA;could not do it in Go, but maybe that has changed.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;a href=&#34;http://www.tryremote.com/jobs.html&#34;&gt;More remote jobs links at&#xA;tryremote.com&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;A collection of the best resources for remote workers.&lt;/p&gt;&#xA;&lt;p&gt;(Original gopher graphics by &lt;a href=&#34;http://reneefrench.blogspot.com&#34;&gt;Renee&#xA;French&lt;/a&gt;, modifications by&#xA;&lt;a href=&#34;https://blog.golang.org/gopher&#34;&gt;unknown&lt;/a&gt;.)&lt;/p&gt;&#xA;</content>
    <link href="https://oyvindsk.com/posts/go-remote-jobs" rel="alternate"></link>
    <summary type="html">Go (or golang) is a simple, general purpose programming language that excels at writing things like backend services. It&#39;s the language used to make Docker, among many other things</summary>
    <author>
      <name>Øyvind Gerrard Skaar</name>
      <email>hello@oyvindsk.com</email>
    </author>
  </entry>
  <entry>
    <title>How-to build Docker from source</title>
    <updated>2015-07-23T00:00:00Z</updated>
    <id>tag:oyvindsk.com,2015-07-23:/posts/docker-build-from-source</id>
    <content type="html">&lt;p&gt;&lt;img src=&#34;/static/posts/small_v-trans.png&#34; alt=&#34;&#34;&gt;&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&amp;quot;Docker is an open-source project that automates the deployment of&#xA;applications inside software containers&amp;quot;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Lately the Docker project has grown to include many different projects,&#xA;but the core is still the docker server and client. The client and&#xA;server is contained in the same binary and written in Go (golang). This&#xA;is the binary we&#39;ll compile from source.&lt;/p&gt;&#xA;&lt;p&gt;Docker is pretty easy to install from binaries. They release&#xA;pre-compiled binaries, an install script and many linux distros have&#xA;packages ready to install. So why would you want to build it from&#xA;source? Well, I personally have two reasons: 1) I&#39;m currently tinkering&#xA;with Docker Plugins, a feature under development, and even the&#xA;experimental build is lagging behind the latest developments. 2) Being&#xA;able to modify the source and run the result can be very helpful when&#xA;trying to understand how Docker works.&lt;/p&gt;&#xA;&lt;h1 id=&#34;how&#34;&gt;How&lt;/h1&gt;&#xA;&lt;p&gt;It turns out there are basically two ways of building docker from&#xA;source: The hard way and the easy way. The hard way is to install all&#xA;the dependencies and build everything from scratch. Although this is not&#xA;that hard, docker has more dependencies than expected. The easy way is&#xA;to use their build scripts to automate everything. This saves you all&#xA;the trouble of finding and installing the right dependencies. The&#xA;scripts builds and runs a docker image to compile the binary. So you&#xA;need to have docker installed already to build docker in this way, which&#xA;is the drawback.&lt;/p&gt;&#xA;&lt;p&gt;Being lazy, I&#39;m going to go with the easy way, but if you want to this&#xA;the hard way (without using docker) &lt;a href=&#34;https://github.com/docker/docker/blob/master/Dockerfile&#34;&gt;this&#xA;Dockerfile&lt;/a&gt; is&#xA;a good starting point. From that you can extract all the dependencies&#xA;and steps necessary.&lt;/p&gt;&#xA;&lt;p&gt;The easy way is roughly:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Install docker&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Get the docker source&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Run the included scripts to create the docker image and compile&#xA;everything&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Test the binaries&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Copy the binaries to wherever you want to have them.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;installing-docker&#34;&gt;Installing Docker&lt;/h2&gt;&#xA;&lt;p&gt;If you don&#39;t have docker already, install it. You can find instructions&#xA;on &lt;a href=&#34;https://docs.docker.com/installation/&#34;&gt;docs.docker com&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;For ubuntu this is basically:&lt;/p&gt;&#xA;&lt;pre class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# as root (or prepend with sudo)&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys &#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;sh -c &lt;span class=&#34;s2&#34;&gt;&amp;#34;echo deb https://get.docker.com/ubuntu docker main &amp;gt; /etc/apt/sources.list.d/docker.list&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;apt-get update&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;apt-get install lxc-docker&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Get some dependencies&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;apt-get install make git&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;aside-on-digital-ocean-create-some-swap-space&#34;&gt;Aside: On Digital Ocean? Create some swap space&lt;/h2&gt;&#xA;&lt;p&gt;I&#39;ve had some issues with compiling docker on the smallest Digital Ocean&#xA;plan. I think it&#39;s because it runs out of ram and does not have any swap&#xA;space to fall back to. You can fix this, I think, by creating and&#xA;enabling some swap space:&lt;/p&gt;&#xA;&lt;pre class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# as root (or prepend with sudo)&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;dd &lt;span class=&#34;k&#34;&gt;if&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;/dev/zero &lt;span class=&#34;nv&#34;&gt;of&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;/swapfile &lt;span class=&#34;nv&#34;&gt;bs&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;1M &lt;span class=&#34;nv&#34;&gt;count&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;m&#34;&gt;1000&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;chmod &lt;span class=&#34;m&#34;&gt;600&lt;/span&gt; /swapfile &#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;mkswap /swapfile &#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;swapon /swapfile &#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;swapon -s&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Test that it worked:&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;free -h&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Read more &lt;a href=&#34;https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-ubuntu-14-04&#34;&gt;in this Digital Ocean&#xA;tutorial&lt;/a&gt;&#xA;and &lt;a href=&#34;http://askubuntu.com/questions/566745/allocate-swap-after-ubuntu-14-04-lts-installation&#34;&gt;this AskUbuntu&#xA;question&lt;/a&gt;.&#xA;(If you&#39;re not using Digital Ocean but would like to be, you should use&#xA;my &lt;a href=&#34;https://www.digitalocean.com/?refcode=b099d6f54603&#34;&gt;affiliate link&lt;/a&gt;.&#xA;Perks for you, perks for me :)&lt;/p&gt;&#xA;&lt;h2 id=&#34;get-the-docker-source&#34;&gt;Get the docker source&lt;/h2&gt;&#xA;&lt;p&gt;This should be as easy as fetching the code from Github. Install git if&#xA;you don&#39;t have it already and run:&lt;/p&gt;&#xA;&lt;pre class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;git clone https://github.com/docker/docker.git&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nb&#34;&gt;cd&lt;/span&gt; docker&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;compile-docker-in-a-docker-container&#34;&gt;Compile docker in a docker container&lt;/h2&gt;&#xA;&lt;p&gt;The Dockerfile and supporting scripts make it pretty easy to compile a&#xA;new docker from source, they do all the heavy lifting for you. This&#xA;works by first building a new docker image from &lt;a href=&#34;https://github.com/docker/docker/blob/master/Dockerfile&#34;&gt;the&#xA;Dockerfile&lt;/a&gt;,&#xA;running this image and compiling a new docker binary. Since it&#39;s&#xA;building a new docker image, the docker server (docker -d) must be&#xA;running. Hence the need for installing docker first. This docker image&#xA;then has all the dependencies necessary to build docker from source. The&#xA;docker binary is build inside this container and copied out afterwards.&#xA;Ideally the included Makefile and scrips do all of this for us, and&#xA;produce a binary ready to use:&lt;/p&gt;&#xA;&lt;pre class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# as root (or prepend with sudo)&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;make build &#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# this takes a while and prints the output from &amp;#34;Docker build .&amp;#34; &lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# It ends with: &amp;#34;Successfully built ..&amp;#34;.&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# as root (or prepend with sudo)&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;make binary&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# This runs the image we created with &amp;#34;make build&amp;#34;. &lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Ends with &amp;#34;Created binary: bundles/1.8.0-dev/binary/docker-1.8.0-dev&amp;#34;,&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# where &amp;#34;1.8.0-dev&amp;#34; is the version I&amp;#39;m building, &lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# the next unreleased version at the time of writing.&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;test-the-new-binary&#34;&gt;Test the new binary&lt;/h2&gt;&#xA;&lt;h3 id=&#34;stop-the-old-docker-daemon&#34;&gt;Stop the old docker daemon&lt;/h3&gt;&#xA;&lt;p&gt;Stop the docker daemon so w can run our new one. On Ubuntu / debian this&#xA;is:&lt;/p&gt;&#xA;&lt;pre class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;service docker stop&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;On other systems it might be.. something else. You can try &lt;em&gt;killall&#xA;docker&lt;/em&gt; or &lt;em&gt;pkill docker&lt;/em&gt;&lt;/p&gt;&#xA;&lt;h3 id=&#34;start-a-daemon-using-our-new-binary&#34;&gt;Start a daemon using our new binary&lt;/h3&gt;&#xA;&lt;pre class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# in the docker/ directory where we ran make build and make binary&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;./bundles/1.8.0-dev/binary/docker -d  &lt;span class=&#34;c1&#34;&gt;# the version, &amp;#34;1.8.0-dev&amp;#34;, will vary according to the version your building&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;run-the-old-binary-as-a-client-and-connect-to-our-new-daemon&#34;&gt;Run the old binary as a client and connect to our new daemon&lt;/h3&gt;&#xA;&lt;p&gt;With the docker server (docker -d) still running, open a new console /&#xA;terminal and run: &lt;em&gt;docker version&lt;/em&gt;. This will use the original docker as&#xA;a client and it should be able to contact our new docker binary. You&#xA;should see the difference in server version and client version, like so:&lt;/p&gt;&#xA;&lt;pre class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;docker version&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Client version: 1.6.0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Client API version: 1.18&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Go version &lt;span class=&#34;o&#34;&gt;(&lt;/span&gt;client&lt;span class=&#34;o&#34;&gt;)&lt;/span&gt;: go1.4.2&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Git commit &lt;span class=&#34;o&#34;&gt;(&lt;/span&gt;client&lt;span class=&#34;o&#34;&gt;)&lt;/span&gt;: &lt;span class=&#34;m&#34;&gt;4749651&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;OS/Arch &lt;span class=&#34;o&#34;&gt;(&lt;/span&gt;client&lt;span class=&#34;o&#34;&gt;)&lt;/span&gt;: linux/amd64&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Server version: 1.8.0-dev&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Server API version: 1.20&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Go version &lt;span class=&#34;o&#34;&gt;(&lt;/span&gt;server&lt;span class=&#34;o&#34;&gt;)&lt;/span&gt;: go1.4.2&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Git commit &lt;span class=&#34;o&#34;&gt;(&lt;/span&gt;server&lt;span class=&#34;o&#34;&gt;)&lt;/span&gt;: c2346f6&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;OS/Arch &lt;span class=&#34;o&#34;&gt;(&lt;/span&gt;server&lt;span class=&#34;o&#34;&gt;)&lt;/span&gt;: linux/amd64&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;As you can see &amp;quot;Client version&amp;quot; and &amp;quot;Server version&amp;quot; are different.&#xA;This is expected since the server is the new binary we just started as a&#xA;daemon (./bundles...docker -d). The client, however, is the docker&#xA;installed on the system. Run &lt;em&gt;which docker&lt;/em&gt; to see where this binary is&#xA;located.&lt;/p&gt;&#xA;&lt;h3 id=&#34;run-the-new-binary-as-a-client-and-connect-to-our-new-daemon&#34;&gt;Run the new binary as a client and connect to our new daemon&lt;/h3&gt;&#xA;&lt;p&gt;You can test the new binary as a client as well:&lt;/p&gt;&#xA;&lt;pre class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# in the docker/ directory where we ran make build and make binary&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;./bundles/1.8.0-dev/binary/docker version&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Client:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt; Version:      1.8.0-dev&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt; API version:  1.20&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt; Go version:   go1.4.2&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt; Git commit:   c2346f6&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt; Built:        Thu Jul &lt;span class=&#34;m&#34;&gt;23&lt;/span&gt; 15:03:21 UTC &lt;span class=&#34;m&#34;&gt;2015&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt; OS/Arch:      linux/amd64&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Server:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt; Version:      1.8.0-dev&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt; API version:  1.20&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt; Go version:   go1.4.2&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt; Git commit:   c2346f6&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt; Built:        Thu Jul &lt;span class=&#34;m&#34;&gt;23&lt;/span&gt; 15:03:21 UTC &lt;span class=&#34;m&#34;&gt;2015&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt; OS/Arch:      linux/amd64&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;As you can see the Client and Server version is now the same. Both the&#xA;server and client is running the same binary file; the one we just&#xA;built. Also, it looks like the output of &lt;em&gt;docker version&lt;/em&gt; changed&#xA;between version 1.6 and 1.8.&lt;/p&gt;&#xA;&lt;h3 id=&#34;last-test-run-a-docker-container&#34;&gt;Last test: Run a docker container&lt;/h3&gt;&#xA;&lt;p&gt;A basic test that everything works is to run the official hello-world&#xA;image using our new binary. Make sure the server is still running and&#xA;run:&lt;/p&gt;&#xA;&lt;pre class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;./bundles/1.8.0-dev/binary/docker run -t -i --rm hello-world&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;installing-our-new-binary-system-wide&#34;&gt;Installing our new binary system-wide&lt;/h2&gt;&#xA;&lt;p&gt;As far as I know, installing the new binary is as simple as copying it&#xA;into place, overwriting the old one. (I&#39;m sure there&#39;s cases where this&#xA;is not enough, or could break things, so, you know.. )&lt;/p&gt;&#xA;&lt;pre class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Where is our old binary?&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;which docker&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Mine is in /usr/bin/docker, so let&amp;#39;s move it&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# as root (or prepend with sudo)&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;mv /usr/bin/docker /usr/bin/docker-old &#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# and copy our new binary in&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;cp ./bundles/1.8.0-dev/binary/docker /usr/bin/&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# run the server with &amp;#34;docker -d&amp;#34; or :&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;service docker start&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Questions? Comments? Found something wrong or confusing? Hit me up &lt;a href=&#34;https://twitter.com/oyvindsk&#34;&gt;on&#xA;twitter&lt;/a&gt; or hello @ this domain&lt;/p&gt;&#xA;</content>
    <link href="https://oyvindsk.com/posts/docker-build-from-source" rel="alternate"></link>
    <summary type="html">Building the go server and client</summary>
    <author>
      <name>Øyvind Gerrard Skaar</name>
      <email>hello@oyvindsk.com</email>
    </author>
  </entry>
  <entry>
    <title>A few (more than one and less than ten) reasons Redis is awesome!</title>
    <updated>2014-12-09T00:00:00Z</updated>
    <id>tag:oyvindsk.com,2014-12-09:/posts/reasons-redis-is-awesome</id>
    <content type="html">&lt;p&gt;Redis describes itself as an:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&amp;quot;Open source, BSD licensed, advanced key-value cache and store. It is&#xA;often referred to as a data structure server since keys can contain&#xA;strings, hashes, lists, sets, sorted sets, bitmaps and hyperloglogs&amp;quot;&lt;/p&gt;&#xA;&lt;p&gt;--- redis.io&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;This is not a Redis tutorial, just a rant. If you want to learn more,&#xA;here&#39;s a few links:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;The little Redis Book: A great free ebook. Somewhat outdated (ca&#xA;2012), but a good start:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;a href=&#34;http://openmymind.net/redis.pdf&#34;&gt;PDF&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://github.com/karlseguin/the-little-redis-book/blob/master/en/redis.md&#34;&gt;Read&#xA;online&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Redis: Swiss army knife: &lt;a href=&#34;https://speakerdeck.com/swanson/redis-swiss-army-knife&#34;&gt;Slides&#xA;(2012)&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Official documentation:&#xA;&lt;a href=&#34;http://redis.io/documentation&#34;&gt;redis.io/documentation&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h1 id=&#34;small&#34;&gt;Small&lt;/h1&gt;&#xA;&lt;p&gt;When you download the latest version from the website, the sourcecode,&#xA;tests, helper scripts etc. is 6.3 MB. The source itself is ~ 2 MB. The&#xA;server binary is ~ 4 MB.&lt;/p&gt;&#xA;&lt;h1 id=&#34;simple&#34;&gt;Simple&lt;/h1&gt;&#xA;&lt;p&gt;Compiling is as simple as one &lt;em&gt;make&lt;/em&gt;. It takes less than a minute on my&#xA;laptop, and I have never seen it fail (although I&#39;m sure it can happen).&lt;/p&gt;&#xA;&lt;p&gt;After compiling you get a bunch of &lt;em&gt;redis-*&lt;/em&gt; files in your &lt;em&gt;src/&lt;/em&gt;&#xA;folder. Run &lt;em&gt;./src/redis-server&lt;/em&gt; and it starts! Done!&lt;/p&gt;&#xA;&lt;p&gt;There&#39;s a lot of config options to set, but adjust when needed, no need&#xA;to worry about that when trying it out.&lt;/p&gt;&#xA;&lt;h1 id=&#34;versatile&#34;&gt;Versatile&lt;/h1&gt;&#xA;&lt;p&gt;Redis is often associated with caching, but that&#39;s just one of its many,&#xA;many uses. People sometimes call it a &amp;quot;swiss army knife&amp;quot;, and that&#39;s&#xA;not a bad analogy. As a low-level tool, it&#39;s best seen as a one little&#xA;program you can use to build a lot of cool stuff upon.&lt;/p&gt;&#xA;&lt;p&gt;Even the basic datatypes become super useful when you have programs in&#xA;written in different languages that want to work on the same data. Redis&#xA;has clients for most languages and platforms.&#xA;(&lt;a href=&#34;http://redis.io/clients&#34;&gt;seriously&lt;/a&gt;). And being fast, Redis actually&#xA;fills the role of data migrator and interpreter nicely.&lt;/p&gt;&#xA;&lt;p&gt;Redis supports different data types, each with a slew of uses:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Strings (basic key-value)&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Hashes&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Sets&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Sorted Sets&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Lists (Stacks, Queues)&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Publish / Subscribe (Message queue)&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;See &lt;a href=&#34;http://redis.io/commands&#34;&gt;Redis commands&lt;/a&gt; for the full, scary list&#xA;of commands, grouped by data type.&lt;/p&gt;&#xA;&lt;p&gt;I&#39;m way too lazy to try to summarize the different usecases, play around&#xA;with them and you&#39;ll probably get some ideas. Or try google.&lt;/p&gt;&#xA;&lt;p&gt;There&#39;s also this: &lt;a href=&#34;http://redis.io/topics/data-types-intro&#34;&gt;Redis data types and&#xA;abstractions&lt;/a&gt; (long but&#xA;useful).&lt;/p&gt;&#xA;&lt;h1 id=&#34;fast&#34;&gt;Fast&lt;/h1&gt;&#xA;&lt;p&gt;A single-server, single-process Redis server does approximately 50 000 -&#xA;100 000 operations a second. This means that you can do 50 Redis&#xA;operations per page load, and still have 1000 concurrent users.&#xA;Obviously this is not Facebook or Google scale, but it&#39;s more than&#xA;enough for many, probably most, usecases. Scaling beyond this can be a&#xA;little tricky, but there&#39;s examples of people making it work.&lt;/p&gt;&#xA;&lt;h1 id=&#34;useful&#34;&gt;Useful&lt;/h1&gt;&#xA;&lt;p&gt;Each of the data types supported by Redis has its usecases. Combine this&#xA;with the cross-platform nature and ease of use, and you get something&#xA;really useful.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;http://openmymind.net/Redis-Is-The-Most-Important-Tool-In-My-Toolbelt/&#34;&gt;Redis Is The Most Important Tool In My Toolbelt&#xA;(2012)&lt;/a&gt;&lt;/p&gt;&#xA;&lt;h1 id=&#34;honest&#34;&gt;Honest&lt;/h1&gt;&#xA;&lt;p&gt;There&#39;s refreshingly little marketing-bs in the documentation and&#xA;community. The documentation lists time complexity, in Big-O notation,&#xA;for each command. And, AFAIK, nobody pretends Redis is going to replace&#xA;everything else and make RDBMS&#39;s obsolete.&lt;/p&gt;&#xA;</content>
    <link href="https://oyvindsk.com/posts/reasons-redis-is-awesome" rel="alternate"></link>
    <summary type="html">This is not a Redis tutorial, just a rant</summary>
    <author>
      <name>Øyvind Gerrard Skaar</name>
      <email>hello@oyvindsk.com</email>
    </author>
  </entry>
</feed>