サクサク読めて、アプリ限定の機能も多数!
トップへ戻る
iPhone 16
blog.gopheracademy.com
The Go Garbage Collector (GC) works exceptionally well when the amount of memory allocated is relatively small, but with larger heap sizes the GC can end up using considerable amounts of CPU. In extreme cases it can fail to keep up. What’s the problem? The GC’s job is to work out which pieces of memory are available to be freed, and it does this by scanning through memory looking for pointers to m
Table of contents Language changes Operating Systems support Tooling Environment Variables go build go install go test gofmt go fix pprof Runtime CGO support Debugging Assembly support Packages Closing notes Introduction Go 1.10 is the first major release after the announcement of the plans towards Go 2.0 at GopherCon 2017. There are a number of exciting changes which I’ll cover below as well as s
Introduction Ever wondered how are your goroutines being scheduled by the go runtime? Ever tried to understand why adding concurrency to your program has not given it better performance? The go execution tracer can help answer these and other questions to help you diagnose performance issues, e.g, latency, contention and poor parallelization. The tool is available since go 1.5 and works by instrum
When I’m writing web applications, I don’t tend use the latest JavaScript front-end hotness, instead I prefer to reload the entire page on a request, or at the most, a small section of it. Today, however, many developers love to write JSON back ends and write their front-end logic using JavaScript. In this article, we’re going to do just that. We’re going to create a small Buffalo application that
Today we will see how we can interact with WebAssembly, from Go: how to execute WebAssembly bytecode from Go and how to generate WebAssembly bytecode with Go. But first of all: what is WebAssembly? WebAssembly According to webassembly.org, WebAssembly (wasm for short) is a new portable, size- and load-time-efficient format suitable for compilation to the web. In a way, wasm is the next evolution o
Introduction As a newcomer to gRPC (in Go) there are many resources setting out what gRPC is, where it originated from and how to create a basic service and client. After completing an introduction to gRPC and setting up a basic implementation I felt a bit lost as to where I need to go next. gRPC consists of more than just sending binary blobs over HTTP/2. gRPC is also a set of libraries that will
If you have ever tried Go, you probably know that writing services with Go is an easy thing. Yes, we really need only few lines to be able to run http service. But what do we need to add if we want to prepare our service for production? Let’s discuss it by an example of a service which is ready to be run in Kubernetes. You can find all examples from this article in the single tag and you can follo
package foo func incr(i int) int { return i+1 } func decr(i int) int { return i-1 } func foo() { decr(incr(0)) } While obviously there are other things that make a program useful, the most fundamental thing that makes a program useful is that it needs to interact with things outside itself. This can come in the form of reading a file, reading a network input, reading user input, printing an output
One of the common criticisms of the GOPATH is that it is hard to create isolated development environments without resorting to hacks, bash scripts, multiple GOPATH settings, or other trickery. Generally, I don’t often have too many problems with GOPATH, but when I do they are frustrating and hard to figure out. An example: Your dependency manager copies deps from your GOPATH into your project’s ve
A regular hash function turns a key (a string or a number) into an integer. Most people will know them as either the cryptographic hash functions (MD5, SHA1, SHA256, etc) or their smaller non-cryptographic counterparts frequently encountered in hash tables (the map keyword in Go). Collisions, where two input values hash to the same integer, can be an annoyance in hash tables and disastrous in cryp
Make is an old tool that you can use today to help get everyone on your team on the same page, and make it easy for new contributors to your project to get started. In some cases Make can help you avoid unnecessary work! Let’s see how you can integrate Make into your development workflow. For this example, we are going to pretend our application uses protocol buffers to send data back and forth. P
Introduction This article will talk about how to connect a GopherJS frontend to a Go backend. If you haven’t heard about GopherJS before, it’s an open source Go-to-JavaScript transpiler, allowing us to write Go code and run it in the browser. I recommend taking a look at the official GitHub repo and Dmitri Shuralyov’s DotGo presentation Go in the browser for a deeper introduction. Writing GopherJS
What is etcd etcd is a key-value store for the most critical data of distributed systems. Use cases include applications running on Container Linux by CoreOS, which enables automatic Linux kernel updates. CoreOS uses etcd to store semaphore values to make sure only subset of cluster are rebooting at any given time. Kubernetes uses etcd to store cluster states for service discovery and cluster mana
With Go following a predetermined release schedule of February - August and a Release Candidate for Go 1.8 just a few days after this article, it looks like we should be able to talk about Go 1.8 without too much fear that things will change. Lets start with some of the low-level changes. You may remember that Go 1.7 introduced a new compiler backend that is based on SSA, or Static Single Assignme
Back when crypto/tls was slow and net/http young, the general wisdom was to always put Go servers behind a reverse proxy like NGINX. That’s not necessary anymore! At Cloudflare we recently experimented with exposing pure Go services to the hostile wide area network. With the Go 1.8 release, net/http and crypto/tls proved to be stable, performant and flexible. However, the defaults are tuned for lo
Developers often tend to think about designing software in terms of using logical layers of abstractions. I have seen many Go projects with layers of abstractions that reflect grouping of all common things together such as types (model), handlers for all services (api or controllers), and even multi-purpose packages (util). These ways of organizing code are not putting Go package features to good
The Saga of Go Dependency Management The Go community is on the cusp of some major shifts in the way we handle dependencies. These shifts are a long time coming, and involve the work and effort of dozens, if not hundreds, of people. Six to twelve months from now, the Go dependency management landscape is likely to look very different. For those who haven’t been following closely - or, honestly, ev
Year’s end is coming closer. Time to clean up repositories and polishing up the toolset. All the well-known tools have been installed already–is there anything else to add to the toolbox? Here are a few useful tools that you might not have in your toolbox yet: interfacer, zb, realize, and binstale. They have nothing in common except that each of them solves a particular problem well. interfacer: S
One of the shiny new toys in Go 1.7 is the ‘context’ library. Not shiny as in it is genuinely new. It started out at golang.org/x/net/context, which is where you’ll need to import it from if you’re on 1.6 or before - but don’t worry, the old import path is completely forwards compatible. This library has been considered significant enough to make it into the standard library, and for good reason.
How Do They Do It: Timers in Go This article covers the internal implementation of timers in Go. Note that there are a lot of links to Go repo in this article, I recommend to follow them to understand the material better. Timers Timers in Go just do something after a period of time. They are located in the standard package time. In particular, timers are time.Timer, time.Ticker, and less obvious t
What is etcd? etcd is a distributed, consistent key-value store, written in Go. Similar to how Linux distributions typically use /etc to store local configuration data, etcd can be thought of as a reliable store for distributed configuration data. It is distributed by replicating data to multiple machines, therefore highly available against single point of failures. Using the Raft consensus algori
Having been a Java developer for many years, I have simply lost interest in Java and want to code everything in Go, mostly due to Go’s simplicity and performance. But it’s Java that is having fun in the party of big data. Go is sitting alone as a wall flower. There is no real map reduce system for Go, until now! Glow is aiming to be a simple and scalable map reduce system, all in pure Go. Not only
With the release of Go 1.5, there is a new way the go tool can discover go packages. This method is off by default and the surrounding tools, such as goimports, do not understand that folder layout. However in Go 1.6 this method will be on for everyone and other tools will have support for it as well. This new package discovery method is the vendor folder. Before we look into the solution and sema
I maintain Anaconda, the Twitter client library for Go. There are a lot of interesting things I could write about Anaconda - for example, automatic rate-limiting and throttling using the tokenbucket library. Today, I’d like to demonstrate symmetric API testing in Go, which Anaconda highlights quite well. The asymmetric approach to testing the client library would be to test each function by queryi
When I’m working on the Gogs project, there is a need of builtin SSH server, which allows users to preform Git-only operations through key-based authentication. The available resources on the web are all minimal examples and do not fit this specific requirement. Therefore, I think it’s worth sharing my experiences to make your life easier in case you just run into same problem as mine. The code st
Alastair O’Neill gave a talk at the BSides Manchester security conference in August about userland rootkits that use the LD_PRELOAD mechanism. Most of these rootkits are written in C. I knew that as of version 1.5, Go supports a build mode for shared libraries and having seen the talk, I wondered if I could write something similar in Go and learn something about LD_PRELOAD, cgo and building Go sha
Tracking down bugs in your code can be a very frustrating experience. This is even more true of highly parallel code. Having a good debugger at your disposal can make all the difference when it comes to tracking down a difficult, or hard to reproduce bug in your code. Throughout this post I will discuss Delve, which is a debugger specifically built for Go. Delve aims to solve the various issues fe
goa: Untangling microservices The Raise of Microservice Architectures and APIs After suffering through a monolithic Rails application for a number of years, we (the RightScale Engineering team) shifted our focus to microservice architectures. As many others, we have encountered some of their pitfalls as well. One of them is that building good APIs is difficult. Changing APIs is even more difficult
Anyone who spends a few minutes talking with me about development knows I love Go. My Github and Blog are practically a love letter to the language. Today I want to share with you something I’ve been working on for the past year, and I hope you will really get excited about it. Many applications require access to the file system to create, modify or delete files and folders. I’ve always felt a bit
次のページ
このページを最初にブックマークしてみませんか?
『Gopher Academy Blog』の新着エントリーを見る
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く