Ask golang: Who is using Go?

xuanbao · · 505 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>How are you using Go? Are you using Go at work or for hobby projects? </p> <p>If so please let us know in the comments where you&#39;ve been using it, what for, what your deployment is like, and the highs and lows of your Go experience. </p> <hr/>**评论:**<br/><br/>kjk: <pre><p>I used Go to build backend for <a href="https://quicknotes.io">https://quicknotes.io</a> (front-end is react).</p> <p>My deployment setup is as follows:</p> <ul> <li>the app is deployed to latest Ubuntu</li> <li>I use systemd to manage the service (because that&#39;s the standard on Ubuntu)</li> <li>I use ansible to deploy</li> </ul> <p>The deploy steps in ansible are, roughly:</p> <ul> <li>build unix version as a single executable (I package all static resources inside the app)</li> <li>copy the executable under sha1 path (my standard is /home/${user}/www/app/${sha1}. That way I keep N latest versions for easy rollback</li> <li>stop the currently running version using systemd</li> <li>symlink the version I just copied under /home/${user}/www/app/latest (that way systemd scripts have a stable location for the executable)</li> <li>use systemd to start newly copied version</li> </ul> <p>The highs of Go is that it&#39;s fast (my CPU usage hovers ~4%, so there&#39;s lots of room to grow) and stable (some of my other web apps run for months without any problems - I only restart them when deploying new versions).</p> <p>I don&#39;t have any complaints: having programmed in C++ and Python and C# before, Go gives me the least amount of problems.</p></pre>bluhue: <pre><p>Could I ask how you managed to pack static assets into the Linux executable? I was looking to do exactly that a few months ago, but couldn&#39;t figure it out.</p></pre>kjk: <pre><p>There are projects that help you do that, for example <a href="https://github.com/jteeuwen/go-bindata">https://github.com/jteeuwen/go-bindata</a> but I have a very simple solution of my own based on similar principles.</p> <p>As part of the build process I use a simple .go program I wrote that: * packs all static resources (html templates, js code, images etc.) into a single .zip file (using go&#39;s built-in zip package) * I generate resources.go file that has that zip file as a single []byte global variable</p> <p>Then at program startup I decode that data from .zip file into memory, using a hash to map file name to content and then use that data in place of reading from file system.</p> <p>go-bindata and other similar projects work the same way.</p> <p>There are variations on this technique (instead of using a .zip file you could have a global variable per file).</p> <p>If you want to see an example of this technique in practice, you can study <a href="https://github.com/sosedoff/pgweb/blob/master/Makefile">https://github.com/sosedoff/pgweb/blob/master/Makefile</a></p> <p>My program isn&#39;t open source but I can share the build-time script that creates .zip file and generates resources.go: <a href="https://gist.github.com/kjk/0782a36fa4e62f32c19d">https://gist.github.com/kjk/0782a36fa4e62f32c19d</a></p></pre>giant_pollo: <pre><p>Thanks for sharing! Really interesting stuff and I like your coding style in that gist. Looks so clean and nice.</p> <p>Your setup feels rock solid too.</p></pre>sethammons: <pre><p>I use it for side projects, and we use it extensively at SendGrid in production. Our incoming server is in Go. We have a bunch of supporting services that our older daemons utilize that are in Go. Everything new is written in Go (unless there is a compelling reason not to). </p> <p>Deployments are odd because we want &#34;one system to rule them all&#34; that is deploying python, perl, ruby, php, and go. Our repos are all expected to have a set of common bin script names (bin/test, bin/build, bin/package, ...) and must output an RPM. Our build tools leverage these scripts.</p> <p>The lows... there was some learning pain. A lot of &#34;oh, we need a library for this and that&#34; before actually <em>needing</em> it (after all, we needed a lib for this and that in perl and python, right?). We could have done better by sticking with the standard library in many places as we got our feet wet. There was a lot of &#34;we need $FOO because language $BAR has it.&#34; After we learned to do things The Go Way (tm), we got a lot better. Some other early lessons learned: close http responses, slices are a reference type, use worker pools, and profile before &#34;optimizing.&#34; </p> <p>The highs - remember that &#34;better&#34; I just mentioned? Our incoming server was previously Python/Twisted (and such an aptly named library!). With some lessons learned, one of our teams rewrote our incoming servers in Go and we got about 130x improvement. I love writing and working in Go. Just the other day I had to hop into a repo I&#39;ve never worked on to fix a concurrency bug affecting clean shutdowns. In python/twisted or perl/anyevent (what our older services use), this would have been a dreaded activity. In Go, it was easy to reason about, easy to verify and test, and straight forward to fix. </p> <p>For what we do, I really enjoy Go. </p></pre>fortyninezeronine: <pre><p>I use Go for hobby projects and at work.</p> <p>Hobby stuff: miscellaneous utilities</p> <p>Work: web server, custom long-term data storage system, miscellaneous utilities to support management of both of those services, etc.</p> <p>Deployment for work-related stuff is not ideal at the moment, as it&#39;s not really automated:</p> <ul> <li><code>go build</code> w/tag + version information</li> <li>scp build up to target servers <em>manually</em></li> <li>update configuration if necessary <em>manually</em></li> <li>run a shell script to gracefully stop/restart the service <em>manually</em></li> <li>move on with my day</li> </ul></pre>dominotw: <pre><blockquote> <p>Distributed web server</p> </blockquote> <p>Curious what you mean by this.</p></pre>driusan: <pre><p>Me too.. the only thing I can think of is a fancy way of saying &#34;load balancer&#34;? </p></pre>fortyninezeronine: <pre><p>Yeah, it&#39;s a fancy way of saying: we have a web service that needs to kinda cooperate with other instances of itself across our various machines.</p></pre>very-little-gravitas: <pre><p>You might find ansible interesting for deployment (that&#39;s what I use, after the learning curve I&#39;m pretty happy with it) - you can probably get the above down to a one-step process. Would be interesting to hear how others are deploying go apps.</p></pre>fortyninezeronine: <pre><p>Yeah, I actually started looking at Ansible on Friday, followed by a quick-and-dirty fabric implementation of what I typically do. I&#39;ll probably look into doing something less lazy (i.e. Ansible) in the near future.</p></pre>GreeTiger: <pre><p>Used it for a couple small backend things at work (replacing a slow Python cronjob) but mainly for hobby projects: <a href="https://podbaby.me">https://podbaby.me</a> is one I&#39;m using myself day-to-day.</p> <ul> <li>Godep for dependencies</li> <li>Ansible for deployment (tried docker: turned out to be overkill for my modest needs)</li> <li>Digital Ocean for hosting</li> <li>Supervisord for keeping the lights on</li> <li>LetsEncrypt for SSL</li> <li>Nginx for web server</li> <li>Echo framework for routing</li> <li>PostgreSQL for database (using sqlx on the Go end)</li> <li>Redis for caching</li> <li>ReactJS for front end</li> <li><p>Bootstrap + theme for design (I suck at design, just wanted something simple and mobile-friendly out the box)</p></li> <li><p>Highs: fast, straightforward, easy to refactor. Reminded me a little of Java in the early days of servlet programming before it went down the J2EE enterprise rabbit hole. </p></li> <li><p>Lows: no clear &#34;one way to do it&#34; re webapps. A dozen different routers, lack of proper context and error handling in core http handlers means everyone does it their own special way (I understand that may be fixed soon). Lack of decent examples out there (I mean large, working open source projects, not toy examples and tutorials). </p></li> </ul> <p>I didn&#39;t mind the lack of an ORM - it was quite refreshing being forced to use PostgreSQL features properly (amazing how your RDBMS knowledge atrophies after years of ORM usage). Biggest pain was in React development, lots of churn in libraries + steep learning curve.</p></pre>sacado: <pre><p>I&#39;m using Go in a university research lab (research about AI). We use it for a bunch of tasks :</p> <ul> <li><p>as a tool to generate static content from databases to our website ; we use go because it lets us deploy executables directly on the web server. No need to check version x of PHP or y of Python, no risk the program fails after an update.</p></li> <li><p>as a prototyping tool for various AI research projects. Go is a good sweet spot between dead fast languages like C/C++ that aren&#39;t really adapted to prototyping, and dead-slow, prototyping-friendly language like Python. Plus, Go is easy to learn for new engineers that happen to work with an existing codebase. Finally, it is easy for researchers in the lab to test each other&#39;s prototype : no ./configure &amp;&amp; make, no need to have the right version of Python or Java, just download the right executable for your architecture and run it.</p></li> </ul> <p>So, advantages of Go for us : easy deployment, sweet spot for system tools and AI prototypes. However, Go is far from being the main PL used here. C/C++ and, to a lesser extent, Java, rule as masters here.</p></pre>kjk: <pre><p>I have a list of companies using Go: <a href="https://quicknotes.io/n/1XB0-companies-using-go" rel="nofollow">https://quicknotes.io/n/1XB0-companies-using-go</a></p></pre>sethammons: <pre><p>You can add SendGrid to that list</p></pre>kjk: <pre><p>Done, thanks for providing more info about how SendGrid uses Go.</p></pre>kor_the_fiend: <pre><p>Using Go at work, currently working on a UDP server for high volume metrics ingestion. Using Docker for the build, then deploying to an on-prem cloud based on Apache Mesos.</p></pre>tieubao: <pre><p>I&#39;m running a software company called <a href="http://www.dwarvesf.com" rel="nofollow"><strong>Dwarves Foundation</strong></a> in Saigon, Vietnam and Ontario, Canana. We are using Go to develop stuffs for our partners and customers. </p> <p>We work with Go for one and half year. Most of the time we use it to develop command line tool, web app or API server. Some use cases are</p> <ul> <li>Use <a href="https://github.com/gin-gonic/gin" rel="nofollow">gin</a> to build backend of <a href="http://www.delivr.to:" rel="nofollow">http://www.delivr.to:</a> p2p delivery platform</li> <li>Use <a href="https://github.com/astaxie/beego" rel="nofollow">beego</a> to build web app <a href="http://voicesofsales.com" rel="nofollow">http://voicesofsales.com</a></li> <li>Other cli can be found on our Github like <a href="https://github.com/dwarvesf/glod-cli" rel="nofollow"><strong>glod-cli</strong></a>: youtube-dl that written in Go</li> </ul> <p>For deployment, we apply docker centric workflow. Ansible is used to provisioning purpose. After that the docker-compose script will be run to do the rest. The deployment stack is liked: Ansible + Docker + Docker Compose + Gitlab CI + Tutum/Docker Hub.</p> <p>I also wrote a answer about Go on Quora. Check it <a href="https://www.quora.com/As-a-Web-developer-coming-from-Python-Django-background-should-learn-Golang-or-Elixir-Phoenix-Why/answer/Han-Ngo-2" rel="nofollow">https://www.quora.com/As-a-Web-developer-coming-from-Python-Django-background-should-learn-Golang-or-Elixir-Phoenix-Why/answer/Han-Ngo-2</a></p></pre>travisjeffery: <pre><p>Used Go to build large parts of the infratructure for <a href="http://stash.cool/" rel="nofollow">Stash</a>, Segment, and Taplytics. I primarily use Elixir/Erlang for server stuff now, but Go is still #1 for building clients.</p></pre>kadema: <pre><p>I used Go for the backend at <a href="https://zinniapos.com" rel="nofollow">zinniapos.</a> I am evaluating solutions for deployment but I use git in the mean time. I really can&#39;t complain about GO. I learnt the language as I used it. It felt very intuitive to me and the performance is just amazing.</p></pre>buckhx: <pre><p>I&#39;m using it to build out geospatial tooling.</p></pre>bbrazil: <pre><p>We&#39;re using it for <a href="http://prometheus.io" rel="nofollow">http://prometheus.io</a>, which is deployed in production at over a hundred companies. It&#39;s good systems language, and the single binary deployment helps a fair bit.</p></pre>mixedCase_: <pre><p>We&#39;re a small startup currently developing an ERP solution and we&#39;re using Go for the backend and Docker for deployment.</p></pre>docoptix: <pre><p>Using Go with AppEngine as a HTTP backend for an Angular webapp and (non-Go) native mobile clients. Deployment is done via the AppEngine-provided command line tools.</p> <p>Highs: Short compile times combined with out-of-the-box testing give me line-by-line test coverage in my editor ~3-4secs after file save. That includes database integration tests.</p> <p>Lows: Sometimes a panic/nil-pointer access stacktrace is hard to analyse because 1000s of lines or so.</p> <p>All in all I am very happy with that stack.</p></pre>dazzford: <pre><p>We&#39;re using go (at work) to build our next gen ad-tech system.</p></pre>SirLudicrus: <pre><p>Any company name we can look up? <a href="https://www.arbor.io" rel="nofollow">We&#39;re in the same field!</a> And use Go for a similar purpose, building a highly performant webservice and backing store for the data it accepts (think Kafka.)</p></pre>varun06: <pre><p>I use Go for work. In fact in my company (mediamath.com) we use go for lots of things. My team is building a distributed durable messaging system using kafka as backend. We use consul for service discovery. Packer and terraform (some bash and some ansible) for deployment. our service is running on both AWS and our own data center. We also have a simlple go service that is handling 3-4 mm rps.</p></pre>jessegreathouse: <pre><p>At <a href="https://www.sparefoot.com" rel="nofollow">https://www.sparefoot.com</a> I snuck in a Go project as a background worker that uses an Aws SQS queue as a queue for our MySQL server. It works flawlessly biting off up to 10 queries at a time and running them concurrently. It runs in a docker container that only takes up about 8MB of memory last I checked. We&#39;re a shop that typically only uses PHP and Node.JS but I&#39;m hoping other start to notice how useful Go can be for certain tasks.</p></pre>volker48: <pre><p>I use Go both for work and hobby projects. Most recently for a company sponsored hackathon project that the company decided to turn into a full fledged product <a href="http://blockbust.io/" rel="nofollow">http://blockbust.io/</a>. We have a full tech write up here <a href="https://medium.com/@BlockBust" rel="nofollow">https://medium.com/@BlockBust</a>.</p> <p>Working in Go for this project was great. Very easy to deploy a single binary and Go scales very well for async networking operations like this.</p></pre>ikofai: <pre><p>The company I work at was C# based when I started. After 1.5 years of slowly converting (both the code base and other developers) we are now 100% Golang. We have a huge micro-service based back end that is always crunching large amounts of data from our hardware in the field. Since switching to Golang the faults that would arise in our system have almost dropped to zero (at least on the software side)</p> <p>To answer OPs question:</p> <p>We use it for both our website APIs and back end services. Our services are mostly built around Go-Kit (<a href="https://github.com/go-kit/kit" rel="nofollow">https://github.com/go-kit/kit</a>) and discovered/configured by Consul (<a href="https://www.consul.io/" rel="nofollow">https://www.consul.io/</a>). These services are mostly backed by MongoDB and communicate either directly via their APIs or indirectly via RabbitMQ. Other services make use of BoltDB or Reddis as required. Everything is built to scale horizontally and vertically.</p> <p>Our infrastructure resides on Amazon EC2 and is managed/deployed by Packer (<a href="https://www.packer.io/" rel="nofollow">https://www.packer.io/</a>) and Terraform (<a href="https://www.terraform.io/" rel="nofollow">https://www.terraform.io/</a>). Thus far our server deployment time has shrunk from easily 5+ hours to about 15 minutes. </p></pre>jtsylve: <pre><p>We use go extensively as the back end for our digital forensics analysis tool. We&#39;ve seen massive improvements over the legacy code that we&#39;re replacing. </p></pre>tvmaly: <pre><p>I use Go in my side project <a href="https://bestfoodnearme.com" rel="nofollow">https://bestfoodnearme.com</a> I host my app and related microservices on a private git repo. On my production host, I build the binaries then I stop the services via systemd, copy over the new binary and start them back up. </p> <p>I am starting to use Go at my day job at an electronic brokerage but it takes time to build up all the supporting libraries I need. I did benchmark some of the tasks and Go was 5x faster than the current program I was using.</p></pre>kpurdon: <pre><p>We use Go to build most of the back end at Bitly. This includes the next version of our API (currently written in Python), our entire queuing system (using <a href="http://nsq.io/" rel="nofollow">NSQ</a> which we built in house and open-sourced), and much more. I also use it for personal projects here and there.</p></pre>kaeshiwaza: <pre><p>Freelance programmer, I first used Go to replace Python when I needed speed and websocket for an online scrabble game <a href="http://seps.flibuste.net" rel="nofollow">http://seps.flibuste.net</a> . Now looking to use it for more classic projects if I can gain in maintainability and ease of deployment.</p></pre>dlsniper: <pre><p><a href="https://github.com/golang/go/wiki/GoUsers" rel="nofollow">https://github.com/golang/go/wiki/GoUsers</a></p> <p>Using Go feels like the Stockholm Syndrome. At first you might not like it then you can let it go.</p></pre>very-little-gravitas: <pre><p>Thanks for the list, I thought it might be interesting to see what people are up to just now with Go and get their first-hand experiences with the language. Are you using it for anything at the moment? </p> <p>I think my biggest hurdle with Go at first was letting go (ha) of inheritance (which I didn&#39;t really need but was used to), and slices of structs vs slices of interfaces requiring manual conversion (but discovered good reasons for that), it has been pretty painless otherwise and I actually enjoyed the learning experience.</p></pre>newimprovedoriginal: <pre><p>Uber uses go for it&#39;s highest query per second service. <a href="https://eng.uber.com/go-geofence/" rel="nofollow">https://eng.uber.com/go-geofence/</a></p></pre>hahainternet: <pre><p>I&#39;m a freelance programmer. I use Go for anything I want to be fast or relatively safe</p> <p>I&#39;ve recently written a system for instantiating Go types to mirror a DSL. It&#39;s fun!</p></pre>devsquid: <pre><p>I&#39;ve been using it for a couple side projects. But we will be using it for a webserver in a few months</p></pre>

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

505 次点击  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传