网络编程是并发大显身手的一个领域,由于服务器是最典型的需要同时处理很多连接的程序,这些连接一般来自于彼此独立的客户端. 本小节,我们会讲解go语言的net包,这个包提供编写一个网络客户端或者服务器程序的基本组件,通信可以是使用TCP,UDP或者Unix domain sockets. 我们的第一个例子是一个顺序执行的时钟服务器,它会每隔一秒钟将当前时间写到客户端: // Clock1 is a TCP server that periodically writes the time. packa…
http://devs.cloudimmunity.com/gotchas-and-common-mistakes-in-go-golang/ 50 Shades of Go: Traps, Gotchas, and Common Mistakes for New Golang Devs Go is a simple and fun language, but, like any other language, it has a few gotchas... Many of those gotc…
我学习go的五个感悟(译) 原文 5 things about programming I learned with Go By MICHAŁ KONARSKI Go在最近一段时间内开始变得十分流行.语言相关的论文和博客每天都在更新,新的golang相关的项目在github中也层出不穷.Go语言的会议也吸引了越来越多的开发者的关注.Go语言的时代已经来临,并且当选了TIOBE的2016年度语言,并一度进入流行度前十. 我一年前开始接触golang,然后决定试一试.经过一段时间的接触,我发现这绝对…
Contents Tutorial Hello, World Command-Line Arguments Finding Duplicate Lines A Web Server Loose Ends Program Structure Names Declarations Variables Assignments Type Declarations Packages and Files Scope Basic Data Types Integers Floating-Point Numbe…
你很可能从某种途径听说过 Go 语言.它越来越受欢迎,并且有充分的理由可以证明. Go 快速.简单,有强大的社区支持.学习这门语言最令人兴奋的一点是它的并发模型. Go 的并发原语使创建多线程并发程序变得简单而有趣.我将通过插图介绍 Go 的并发原语,希望能点透相关概念以方便后续学习.本文是写给 Go 语言编程新手以及准备开始学习 Go 并发原语 (goroutines 和 channels) 的同学. 单线程程序 vs. 多线程程序 你可能已经写过一些单线程程序.一个常用的编程模式是组合多个函…
Go Concurrency Patterns: Timing out, moving on GO并发模式: 超时, 继续前进 23 September 2010 Concurrent programming has its own idioms. A good example is timeouts. Although Go's channels do not support them directly, they are easy to implement. Say we want to…
Frequently Asked Questions (FAQ) Origins 起源 What is the purpose of the project? What is the history of the project? What's the origin of the gopher mascot? Why did you create a new language? What are Go's ancestors? What are the guiding principles in…
Documentation文档 The Go programming language is an open source project to make programmers more productive. go语言是一个开源项目,是程序员开发更有效率. Go is expressive, concise, clean, and efficient. Its concurrency mechanisms make it easy to write programs that get t…
Web Configuring Your .npmrc for an Optimal Node.js Environment Web Developer Security Checklist HTTPS on Stack Overflow: The End of a Long Road TypeScript 2.2: Mixin Classes Introducing the TypeScript Cookbook Performance Analysis Reference Golang Us…