手机游戏服务器端安装nodejs用node.js 还是用go,fibjs之类等比较好

这篇文章绝不是一篇讨论 NodeJS 和 Ruby on Rails 孰优孰略的檄文。它描述的只是我们做决策过程中的一些思考、决策背后的原因。两种框架都非常优秀,都出色的完成了它们的设计初衷,这也是为什么我们部分的模块仍然运行在NodeJS上的原因。[]
前不久Oreilly出了一本小册子“What is Node?”,扼要的讲解了Node的身世和所适用的场景,作者文笔轻松流畅、内容充实,是非常难得的学习资料。翻译出来,和大家分享~
本文分别介绍在Mac, Ubuntu,Centos以及Windows下安装Node.js.
Node 是一个服务器端JavaScript 解释器,可是真的以为JavaScript不错的同学学习Node就能轻松拿下,那么你就错了,Node 的目标是帮助程序员构建高度可伸缩的应用程序,编写能够处理数万条同时连接到一个物理机的连接代码。这时期最迫切的需要是寻求一个超轻量的后端来架起我的框架,于是触爪伸向传说中的Server-Side Javascrpt。后端JS最出名无疑是Ryan Dahl的node.js,另一个是aptana IDE提供商搞出的jaxer之前听说过Node.js,只是知道它可以应用于服务器端.今天我们就要介绍在CentOS5.6上如何安装Node.js。简单地说,NodeJS是一个使用了Google高性能V8 引擎 的服务器端JavaScript实现。它提供了一个(几乎)完全非阻塞I/O栈,与JavaScript提供的闭包和匿名函数相结合,使之成为编写高吞吐 量网络服务程序的优秀平台。继前面的NodeJS的Hello,World!我们还可以看到其他强大之处,NodeJS现在社区的火热,以及大批工程师对它的支持之下,现在已经陆续的引出了大量的module出来了。
《星噬》确实引起了我的兴趣,因为它很简单,但玩法很吸引人,不过明显缺少支持多人玩的功能。我一下子来了劲,想解决这个问题。于是,osMUs(MU指多人玩)应运而生,这是一款基于浏览器的多人玩的《星噬》克隆版游戏。
本文向您介绍Node.js扩展模块――Hashish。Hashish是JavaScript的一个Hash组合子库,换句话说,它包含了一系列数据结构操作功能。 node.js 是一个可以使用 JavaScript 开发服务器端应用的平台。它依托于 Google V8 JavaScript 引擎,并采用事件 I/O 的架构,可以用来创建高性能服务器。本文详细介绍了 node.js 的基本知识、模块化的结构、事件驱动的机制以及常用的模块。node.js对所有外部资源调用提供异步机制,文件IO也不例外。在这种异步机制下,进程不会被阻塞,这极大提高了CPU的利用率,为单进程的模式奠定了基础。memcache是常用的key-value缓存解决方案,它的协议也被用于nosql数据库tokyo tyrant。最近正好在学习node.js,于是决定用node.js搭一个node.js的反向代理。对php、java等客户端,实现与memcache相同的协议。将客户端的请求,根据请求的key值分别转发到后端的目前用Node.js开发网站最著名的框架是Express,使用起来也是比较容易的。前段时间看到CNodeJS社区的一篇文章,有同学将一个Python写的ToDo列表网站移植到了Node.js上,我为了推广Jscex,就fork了这个项目,将其修改为基于Jscex的版本,大伙儿可以来比较一下。Node.js 并非与 JavaScript 抗衡,而是使用它作为完整的开发堆栈,从服务器端代码一直延伸到浏览器。Node.js 还充分利用了另一种创新思想:通过回调利用异步 I/O 的并发性模型。
????????????????
51CTO旗下网站多背点儿单词这个时候会有用。
多背点儿单词这个时候会有用。
Golang用了大概有3个月了。对于我所在的team,之前C++一直是主力开发语言,生产环境中大多数系统都是用C++实现的;但是考虑到目前公司所用C++框架的局限性,以及Golang语言层面对并发的良好支持,我们毅然决然地用Golang来进行新项目的开发。得益于team之前模块化做得比较干净,模块之间通信用pb实现,我们倒还没有遇到需要直接调用C++动态库或者静态库的场景。&br&不过出于好奇,查了一下相关资料。go调用C++库主要有两种方式:&br&&ol&&li&CGO:
&p&cgo可以通过wrapper来调用C/C++代码,但是并不是一个容易实现的方式。&/p&C++ &a href=&///?target=http%3A///questions/1713214/how-to-use-c-in-go& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&wrapper - How to use C++ in Go?&i class=&icon-external&&&/i&&/a& 这里有比较好的例子&/li&&li&SWIG:同时支持gc和gccgo这两种go编译器;&a href=&///?target=http%3A//zacg.github.io/blog//calling-c-plus-plus-code-from-go-with-swig/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Calling C++ Code From Go With SWIG&i class=&icon-external&&&/i&&/a&
可以参考这个例子&/li&&/ol&&br&看swig文档,一直在标榜自己使用比cgo方便很多,但是看了一些范例,愣是都没有看出方便在哪里。不过话说回来,go调用c++本来就不是一件容易的事,为了避免rewrite现有代码,这些代价也是难免需要付出的。个人感觉,如果想在go里面调用一个大型的C++,绝对不会容易。&br&其实如果性能不是最大矛盾点的话(在当前主流系统下,我并不觉得性能会是一个大问题),楼上被折叠的答案未尝不是一种值得考虑的方案,socket访问本地c++起的server来进行调用,大概也是慢不了的。&br&&br&附一些参考资料:&br&&ul&&li&stackoverflow 如何在Go中使用C++ &a href=&///?target=http%3A///questions/1713214/how-to-use-c-in-go& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&wrapper - How to use C++ in Go?&i class=&icon-external&&&/i&&/a&&/li&&li&SWIG实践 &a href=&///?target=http%3A//zacg.github.io/blog//calling-c-plus-plus-code-from-go-with-swig/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Calling C++ Code From Go With SWIG&i class=&icon-external&&&/i&&/a&&/li&&li&&a href=&///?target=http%3A////& class=& external& target=&_blank& rel=&nofollow noreferrer&&&span class=&invisible&&http://&/span&&span class=&visible&&/&/span&&span class=&invisible&&/&/span&&span class=&ellipsis&&&/span&&i class=&icon-external&&&/i&&/a&使用Cgo的一点总结/&br&&/li&&li&&a href=&///?target=http%3A//www.swig.org/Doc2.0/Go.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&SWIG and Go&i class=&icon-external&&&/i&&/a& swig官方文档&br&&/li&&li&&a href=&///?target=https%3A//golang.org/doc/faq%23Do%255FGo%255Fprograms%255Flink%255Fwith%255FCpp%255Fprograms& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&golang.org&i class=&icon-external&&&/i&&/a& FAQ&br&&/li&&li&&a href=&///?target=https%3A//golang.org/doc/go1.2%23cgo_and_cpp& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&CGO&i class=&icon-external&&&/i&&/a&和C++&/li&&/ul&
Golang用了大概有3个月了。对于我所在的team,之前C++一直是主力开发语言,生产环境中大多数系统都是用C++实现的;但是考虑到目前公司所用C++框架的局限性,以及Golang语言层面对并发的良好支持,我们毅然决然地用Golang来进行新项目的开发。得益于team之前…
数学上都正确,这个定义本来就有好几个&br&比如按&img src=&///equation?tex=r+%3D+a+-+n%5Ctimes%5Ctext%7Btrunc%7D%5Cleft%28+a%2Fn+%5Cright%29+& alt=&r = a - n\times\text{trunc}\left( a/n \right) & eeimg=&1&&&br&或者按&img src=&///equation?tex=r%3Da-n%5Cleft%5Clfloor%7Ba%2Fn%7D%5Cright%5Crfloor& alt=&r=a-n\left\lfloor{a/n}\right\rfloor& eeimg=&1&&&br&IEEE标准是则是&img src=&///equation?tex=r%3Da-n%5Ctimes%5Ctext%7Bround%7D%5Cleft%28a%2Fn%5Cright%29+& alt=&r=a-n\times\text{round}\left(a/n\right) & eeimg=&1&&,然而round标准也有好几个。。。&br&如果round是IEEE默认的round to the nearest,从标准的角度似乎应该是3。。。但IEEE好像也没说其他的round标准不对。。。&br&&br&PS:很多语言干脆提供了两个函数,rem和mod
数学上都正确,这个定义本来就有好几个 比如按r = a - n\times\text{trunc}\left( a/n \right) 或者按r=a-n\left\lfloor{a/n}\right\rfloor IEEE标准是则是r=a-n\times\text{round}\left(a/n\right) ,然而round标准也有好几个。。。 如果round是IEEE默认的…
当我们说“语言层面支持并发”,我们通常是说一种语言提供语法来:&br&&ol&&li&启动并发单元(比如Erlang用spawn关键词启动Erlang processes,Go用go关键词启动goroutines)以及&/li&&li&通信(比如Erlang message passing或者Go channel)或者同步。&/li&&/ol&为什么把通信(communication)和同步(synchronization)用“或者”并列呢?因为通信往往可以用来实现同步。比如Go语言实现的CSP模型里,通信是通过goroutine A发消息到某个channel,而另一个gorotuine B从这个channel里读取消息。Go的channel其实就是我们常用C/C++实现的blocking queue数据结构——如果queue的buffer满了,发消息操作就block了,发送者等接受者读消息之后才能解除发送block——这就是同步了。&br&&br&一个Erlang的例子(摘自:&a href=&///?target=http%3A//www.erlang.org/doc/getting_started/conc_prog.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Erlang -- Concurrent Programming&i class=&icon-external&&&/i&&/a&):&br&&br&&div class=&highlight&&&pre&&code class=&language-text&&-module(tut14).
-export([start/0, say_something/2]).
say_something(What, 0) -&
say_something(What, Times) -&
io:format(&~p~n&, [What]),
say_something(What, Times - 1).
start() -&
spawn(tut14, say_something, [hello, 3]),
spawn(tut14, say_something, [goodbye, 3]).
&/code&&/pre&&/div&&br&这里定义了一个module:tut14,其中有两个函数 say_something和start。start函数调用Erlang语法中的spawn来启动了两个Erlang processes——一个执行 say_something [goodbye, 3],另一个执行 say_something [hello, 3]。&br&&br&&br&一个Go的例子&br&&div class=&highlight&&&pre&&code class=&language-text&&package main
func main() {
go func() { fmt.Println(&hello\n&); }()
&/code&&/pre&&/div&&br&这里通过go关键字启动了一个goroutine,打印hello。&br&&br&Erlang message passing 和 Go channel 的例子不难从网上找到。这里不罗嗦了。权作解释我的答案的例子也够了。
当我们说“语言层面支持并发”,我们通常是说一种语言提供语法来: 启动并发单元(比如Erlang用spawn关键词启动Erlang processes,Go用go关键词启动goroutines)以及通信(比如Erlang message passing或者Go channel)或者同步。为什么把通信(communicatio…
中国在创业开始的时候就有支持月活百万的并发要求了,新加坡,台湾,韩国达到这个PV值公司规模己经比较大了,所以对并发要求和性能要求上中美两国和世界上其它国家总体上来说基本上没有可比性。&br&&br&所以在谈互联网新语言的时候,只谈美国和中国就行了,拉台湾,日本,韩国,新加坡进来没什么意义,这样看的话golang在全世界非常火(如果大陆的情况叫做火的话),在中国非常火就对了。
中国在创业开始的时候就有支持月活百万的并发要求了,新加坡,台湾,韩国达到这个PV值公司规模己经比较大了,所以对并发要求和性能要求上中美两国和世界上其它国家总体上来说基本上没有可比性。 所以在谈互联网新语言的时候,只谈美国和中国就行了,拉台湾…
&p&因为未使用的变量会报错,不能编译,所以用 _ = XXX 来“使用”这个变量,使其通过编译。&/p&&p&为什么用到了 i 变量,还是有 _ = i 这句呢?因为这段代码是用程序生成的,生成器为了方便处理,直接加了这句。例如 l,在这个方法里就没有用到,但因为有 _ = l,所以不影响编译。&/p&&p&这个方法叫 MarshalTo,就更可能是用代码生成的。很多编码解码库都是通过生成代码,而不是用反射来处理各个字段,这样效率会比较高。&/p&&p&代码生成器可以做精细些,用到的变量就不生成 _ = XXX。但是实现起来当然会麻烦些,而且没有明显的益处。_ = XXX 这句会被优化掉的,不影响什么。&/p&&p&平时调试也会用到这个方法来“使用”一个变量,不过调试完肯定清理掉的,不会像自动生成的代码那样留下痕迹。&/p&&p&还有一种使用场景是,在编译期就确保某个类型实现某个接口,例如确保 Foo 类型实现 io.Writer 接口:&/p&&div class=&highlight&&&pre&&code class=&language-text&&var _ io.Writer = Foo{}
&/code&&/pre&&/div&&p&如果 Foo 类型没有实现 io.Writer 接口,那编译就会失败,而不是等到执行时。&/p&
因为未使用的变量会报错,不能编译,所以用 _ = XXX 来“使用”这个变量,使其通过编译。为什么用到了 i 变量,还是有 _ = i 这句呢?因为这段代码是用程序生成的,生成器为了方便处理,直接加了这句。例如 l,在这个方法里就没有用到,但因为有 _ = l,所…
&p&题主好直接。。。&/p&&p&发简历到
题主好直接。。。发简历到
&p&按主流的实现单进程应该是go & java & pypy,因为pypy有GIL,不能充分利用多核性能。但其实这个问题没有太大意义,因为这个跟HTTP server的实现密切相关,完整的框架有更多功能,空跑的性能也会低一些。Go的handler很高效,也很轻,额外的功能很少,所以很快;但如果你实现一个完全不解析HTTP协议、连接进来就直接发送HTTP 200 OK的“HTTP服务器”,那可能会更快,但拿来比显然不合适。Java的主流Web实现本身就是比较完整的东西了,有前端,协议解析,线程池,任务管理之类的,大约相当于Python的WSGI,如果是Servelet比WSGI的话,那应该还是Java要快不少。&/p&
按主流的实现单进程应该是go & java & pypy,因为pypy有GIL,不能充分利用多核性能。但其实这个问题没有太大意义,因为这个跟HTTP server的实现密切相关,完整的框架有更多功能,空跑的性能也会低一些。Go的handler很高效,也很轻,额外的功能很少,所以很…
&ol&&li&Golang的开发团队太固执,不开放,不愿接受社区的意见;例如:拒接增加对泛型的支持。&br&&/li&&li&Golang的Runtime库性能无法达到要求;例如:chan,mutex,select,defer性能有待提高。&br&&/li&&li&Golang的内存管理器性能无法满足要求;内存分配(new,make)和回收(GC)的性能达不到要求。&br&&/li&&li&Golang号称高并发,但高并发时性能不高;目前无法追平Erlang的并发水平。&/li&&li&Golang非常棒,能满足你的要求,你不但不放弃,反而要拥抱她。&/li&&/ol&
Golang的开发团队太固执,不开放,不愿接受社区的意见;例如:拒接增加对泛型的支持。 Golang的Runtime库性能无法达到要求;例如:chan,mutex,select,defer性能有待提高。 Golang的内存管理器性能无法满足要求;内存分配(new,make)和回收(GC)的性能达不到要…
全局一个 gopath 和 每个项目一个单独的 gopath, 各有优缺点.&br&针对2种选择, 各推荐一个较优实践(欢迎分享更好的做法).&br&&br&&br&golang 官方文档里的选择:&br&&a href=&///?target=https%3A//golang.org/doc/code.html& class=& external& target=&_blank& rel=&nofollow noreferrer&&&span class=&invisible&&https://&/span&&span class=&visible&&golang.org/doc/code.htm&/span&&span class=&invisible&&l&/span&&span class=&ellipsis&&&/span&&i class=&icon-external&&&/i&&/a&&br&对应中文文档:&br&&a href=&///?target=https%3A//go-zh.org/doc/code.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&如何使用Go编程&i class=&icon-external&&&/i&&/a&&br&&br&stackoverflow 上两种选择, 也是一半一半.&br&&a href=&///?target=http%3A///questions//whats-a-good-best-practice-with-go-workspaces& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Whats a good best practice with Go workspaces?&i class=&icon-external&&&/i&&/a&&br&&br&------------------------ 全局一个 gopath
做法 -------------------------------------&br&&br&我个人开发环境是设置一个 gopath, 配合 glide 管理. &br&&blockquote&&b&全局一个 gopath 较优方案:&/b&&br&&b&github管理源码 + glide(go 包管理工具)管理依赖包&/b&&/blockquote&&br&&blockquote&&b&glide 介绍:&/b&&br&1.是一个 golang 的包管理工具.&br&2. 功能类似 Python 的 pip + virtualenv. (个人理解)&br&3. 可以锁定项目版本, 会在当前工程目录创建 vendor 目录, 存放所有依赖包.(可认为是个虚拟隔离环境)&br&4. 默认优先从 vendor 下搜索依赖, 找不到, 再从全局 gopath 找.&br&5. 这样不会污染全局的包(避免各项目依赖包版本冲突问题).&/blockquote&glide 工具:
&a href=&///?target=https%3A///Masterminds/glide& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&GitHub - Masterminds/glide: Package Management for Golang&i class=&icon-external&&&/i&&/a&&br&&br&用法: &br&&a href=&///?target=https%3A//glide.readthedocs.io/en/latest/getting-started/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Getting Started&i class=&icon-external&&&/i&&/a&&br&&a href=&///?target=https%3A//blog./2016/05/package-management-for-golang-glide/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Golang 套件管理工具 Glide&i class=&icon-external&&&/i&&/a&&br&&a href=&///?target=https%3A///a/9355& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&glide使用 - golang&i class=&icon-external&&&/i&&/a&&br&&br&如何实践, 可以参考 gogs 项目对 glide 的应用:&br&&a href=&///?target=https%3A///gogits/gogs& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&GitHub - gogits/gogs: Gogs (Go Git Service) is a painless self-hosted Git service.&i class=&icon-external&&&/i&&/a&&br&&br&&br&------------------------ 每个项目设置一个 gopath 推荐做法 ------------------------&br&&br&&blockquote&&b&per 项目 per gopath 推荐做法:&br&使用如下 脚本, 初始化.(非原创)&/b&&/blockquote&&br&&blockquote&优点: &br&1. 自动创建 项目目录结构.&br&2. 每个项目都是设置临时的 gopath, 避免污染全局的 gopath, 属于随用随初始化, 用完就扔那种. &br&&br&用法:&br&&br&保存如下脚本内容到: create_go_proj.sh&br&执行如下命令, 创建项目初始工程目录: &br&sh ./create_go_proj.sh myproject&/blockquote&&br&&br&&div class=&highlight&&&pre&&code class=&language-bash&&&span class=&c&&#!/bin/bash&/span&
&span class=&c&&#########################################################&/span&
&span class=&c&&# Module : mk_go_pro.sh&/span&
&span class=&c&&# Author : Blair Zhong&/span&
&span class=&c&&# Created : &/span&
&span class=&c&&# Modify :&/span&
&span class=&c&&# Version : 1.0&/span&
&span class=&c&&# Useage : ./mk_go_pro.sh&/span&
&span class=&c&&# ./mk_go_pro.sh porject_name&/span&
&span class=&c&&# Description: 创建一个go可编译的工程&/span&
&span class=&c&&#————————————–————————————–&/span&
&span class=&c&&#&/span&
&span class=&c&&# 根据 Go语言学习园地博客的帖子编写,如有侵权请联系本人&/span&
&span class=&c&&# /2012/12/go项目的目录结构/&/span&
&span class=&c&&#&/span&
&span class=&c&&# 默认情况下运行本程序,会生成如下目录和文件:&/span&
&span class=&c&&# test&/span&
&span class=&c&&# ├── bin&/span&
&span class=&c&&# ├── install.sh&/span&
&span class=&c&&# ├── pkg&/span&
&span class=&c&&# └── src&/span&
&span class=&c&&# ├── config&/span&
&span class=&c&&# │
└── config.go&/span&
&span class=&c&&# └── test&/span&
&span class=&c&&# └── main.go&/span&
&span class=&c&&#————————————–————————————–&/span&
&span class=&c&&# 5 directories, 3 files&/span&
&span class=&c&&#&/span&
&span class=&c&&# 其中:&/span&
&span class=&c&&# 1, install.sh为安装文件,&/span&
&span class=&c&&# 2, config.go为test项目的配置文件&/span&
&span class=&c&&# 3, main.go这个你懂的&/span&
&span class=&c&&#&/span&
&span class=&c&&# 生成完毕之后运行进入test目录,运行install.sh会生成如下文件和目录&/span&
&span class=&c&&# ├── bin&/span&
&span class=&c&&# │
└── test&/span&
&span class=&c&&# ├── install.sh&/span&
&span class=&c&&# ├── pkg&/span&
&span class=&c&&# │
└── darwin_amd64&/span&
&span class=&c&&# │
└── config.a&/span&
&span class=&c&&# └── src&/span&
&span class=&c&&# ├── config&/span&
&span class=&c&&# │
└── config.go&/span&
&span class=&c&&# └── test&/span&
&span class=&c&&# └── main.go&/span&
&span class=&c&&# 6 directories, 5 files&/span&
&span class=&c&&#&/span&
&span class=&c&&# 多了两个文件&/span&
&span class=&c&&# 1, bin目录下的test,这个是可执行稳健&/span&
&span class=&c&&# 2, pkg/darwin_amd64下的config.a,这个是config编译后产生的文件&/span&
&span class=&c&&#&/span&
&span class=&c&&# enjoy it!&/span&
&span class=&c&&#########################################################&/span&
&span class=&nv&&PWD&/span&&span class=&o&&=&/span&&span class=&k&&$(&/span&&span class=&nb&&pwd&/span&&span class=&k&&)&/span&
&span class=&nb&&cd&/span& &span class=&nv&&$PWD&/span&
&span class=&k&&if&/span& &span class=&o&&[[&/span& &span class=&s2&&&&/span&&span class=&nv&&$1&/span&&span class=&s2&&&&/span& &span class=&o&&=&/span& &span class=&s2&&&&&/span& &span class=&o&&]]&/span&&span class=&p&&;&/span& &span class=&k&&then&/span&
&span class=&nb&&echo&/span& &span class=&s2&&&Useage: ./mk_go_pro.sh porject_name&&/span&
&span class=&nb&&echo&/span& -ne &span class=&s2&&&Please input the Porject Name[test]&&/span&
&span class=&nb&&read &/span&Answer
&span class=&k&&if&/span& &span class=&o&&[&/span& &span class=&s2&&&&/span&&span class=&nv&&$Answer&/span&&span class=&s2&&&&/span& &span class=&o&&=&/span& &span class=&s2&&&&&/span& &span class=&o&&]&/span&&span class=&p&&;&/span& &span class=&k&&then&/span&
&span class=&nb&&echo&/span& -e &span class=&s2&&&test&&/span&&span class=&p&&;&/span&
&span class=&nv&&PRO_NAME&/span&&span class=&o&&=&/span&&span class=&nb&&test&/span&&span class=&p&&;&/span&
&span class=&k&&else&/span&
&span class=&nv&&PRO_NAME&/span&&span class=&o&&=&/span&&span class=&nv&&$Answer&/span&&span class=&p&&;&/span&
&span class=&k&&fi&/span&
&span class=&k&&else&/span&
&span class=&nv&&PRO_NAME&/span&&span class=&o&&=&/span&&span class=&nv&&$1&/span&&span class=&p&&;&/span&
&span class=&k&&fi&/span&
&span class=&c&&#########################################################&/span&
&span class=&c&&#创建目录&/span&
&span class=&nb&&echo&/span& &span class=&s2&&&Init Directory …&&/span&
mkdir -p &span class=&nv&&$PRO_NAME&/span&/bin
mkdir -p &span class=&nv&&$PRO_NAME&/span&/pkg
mkdir -p &span class=&nv&&$PRO_NAME&/span&/src/config
mkdir -p &span class=&nv&&$PRO_NAME&/span&/src/&span class=&nv&&$PRO_NAME&/span&
&span class=&c&&#########################################################&/span&
&span class=&c&&#创建 install.sh 文件&/span&
&span class=&nb&&echo&/span& &span class=&s2&&&Create install/install.sh …&&/span&
&span class=&nb&&cd&/span& &span class=&nv&&$PRO_NAME&/span&
&span class=&nb&&echo&/span& &span class=&s2&&&#!/bin/bash&&/span& & install.sh
&span class=&nb&&echo&/span& &span class=&s2&&&if [ ! -f install.sh ]; then&&/span& && install.sh
&span class=&nb&&echo&/span& &span class=&s2&&&echo &&/span&install must be run within its container folder&span class=&s2&&& 1&&2&&/span& && install.sh
&span class=&nb&&echo&/span& &span class=&s2&&&exit 1&&/span& && install.sh
&span class=&nb&&echo&/span& &span class=&s2&&&fi&&/span& && install.sh
&span class=&nb&&echo&/span& && install.sh
&span class=&nb&&echo&/span& &span class=&s2&&&CURDIR=\`pwd\`&&/span& && install.sh
&span class=&nb&&echo&/span& &span class=&s2&&&OLDGOPATH=\&\$GOPATH\&&&/span& && install.sh
&span class=&nb&&echo&/span& &span class=&s2&&&export GOPATH=\&\$CURDIR\&&&/span& && install.sh
&span class=&nb&&echo&/span& && install.sh
&span class=&nb&&echo&/span& &span class=&s2&&&gofmt -w src&&/span& && install.sh
&span class=&nb&&echo&/span& &span class=&s2&&&go install &/span&&span class=&nv&&$PRO_NAME&/span&&span class=&s2&&&&/span& && install.sh
&span class=&nb&&echo&/span& &span class=&s2&&&export GOPATH=\&\$OLDGOPATH\&&&/span& && install.sh
&span class=&nb&&echo&/span& && install.sh
&span class=&nb&&echo&/span& &span class=&s2&&&echo &&/span&finished&span class=&s2&&&&&/span& &&install.sh
chmod +x install.sh
&span class=&c&&#创建 config.go 文件&/span&
&span class=&nb&&echo&/span& &span class=&s2&&&Create src/config/config.go …&&/span&
&span class=&nb&&cd &/span&src/config
&span class=&nb&&echo &/span&package config & config.go
&span class=&nb&&echo&/span& && config.go
&span class=&nb&&echo &/span&func LoadConfig&span class=&se&&\(\)&/span& &span class=&o&&{&/span& && config.go
&span class=&nb&&echo&/span& && config.go
&span class=&nb&&echo&/span& &span class=&s2&&&}&&/span& && config.go
&span class=&c&&#创建 main.go&/span&
&span class=&nb&&echo&/span& &span class=&s2&&&Create src/&/span&&span class=&nv&&$PRO_NAME&/span&&span class=&s2&&/main.go …&&/span&
&span class=&nb&&cd&/span& ../&span class=&nv&&$PRO_NAME&/span&/
&span class=&nb&&echo&/span& &span class=&s2&&&package main&&/span& & main.go
&span class=&nb&&echo&/span& && main.go
&span class=&nb&&echo&/span& &span class=&s2&&&import (&&/span& && main.go
&span class=&nb&&echo&/span& &span class=&s2&&& \&config\&&&/span& && main.go
&span class=&nb&&echo&/span& &span class=&s2&&& \&fmt\&&&/span& && main.go
&span class=&nb&&echo&/span& &span class=&s2&&&)&&/span& && main.go
&span class=&nb&&echo&/span& && main.go
&span class=&nb&&echo&/span& &span class=&s2&&&func main() {&&/span& && main.go
&span class=&nb&&echo&/span& &span class=&s2&&& config.LoadConfig()&&/span& && main.go
&span class=&nb&&echo&/span& &span class=&s2&&& fmt.Println(\&Hello &/span&&span class=&nv&&$PRO_NAME&/span&&span class=&s2&&!\&)&&/span& && main.go
&span class=&nb&&echo&/span& &span class=&s2&&&}&&/span& && main.go
&span class=&nb&&echo&/span& &span class=&s2&&&All Done!&&/span&
&/code&&/pre&&/div&&br&附: 原脚本来源 &a href=&///?target=http%3A///2012/12/go%25E9%25A1%25B9%25E7%259B%25AE%25E7%259A%%259B%25AE%25E5%25BD%%25BB%%259E%2584/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Go项目的目录结构 —— Go语言学习园地博客&i class=&icon-external&&&/i&&/a&
全局一个 gopath 和 每个项目一个单独的 gopath, 各有优缺点. 针对2种选择, 各推荐一个较优实践(欢迎分享更好的做法). golang 官方文档里的选择:
对应中文文档:
stackoverflow 上两种选择, 也是一半一半.
补充另一个个人认为重要的feature就是gc效率的提升。堆上分配100万个对象占用1g内存的情况下1.5gc一次是要2到4毫秒的,而1.6只要200多微妙。很大提升了golang处理高并发实时系统的能力。
补充另一个个人认为重要的feature就是gc效率的提升。堆上分配100万个对象占用1g内存的情况下1.5gc一次是要2到4毫秒的,而1.6只要200多微妙。很大提升了golang处理高并发实时系统的能力。
Web服务器也是一个应用程序,这个应用程序打开了TCP的80端口,通过HTTP协议和浏览器交互。&br&&br&Python和Go有非常成熟的类库,你可以用很短的程序来实现一个Web服务器的功能(打开80端口通过HTTP协议与浏览器交互)。&br&&br&可以这样说,基本上任何服务器端的语言都可以编写一个Web服务器,但是Python和Go更容易实现。
Web服务器也是一个应用程序,这个应用程序打开了TCP的80端口,通过HTTP协议和浏览器交互。 Python和Go有非常成熟的类库,你可以用很短的程序来实现一个Web服务器的功能(打开80端口通过HTTP协议与浏览器交互)。 可以这样说,基本上任何服务器端的语言都可…
go语言的全称是:go programming language。&br&go 这个词太通用了,搜索引擎不能很好辨认,所以习惯叫golang.
go语言的全称是:go programming language。 go 这个词太通用了,搜索引擎不能很好辨认,所以习惯叫golang.
golang-nuts&br&reddit/r/golang&br&slack gopher&br&StackOverflow Go&br&golangbridge&br&这几个比较活跃,话题都能得到即时回复。&br&&br&国内的:&br&golangtc&br&gocn&br&studygolang&br&golang-china
golang-nuts reddit/r/golang slack gopher StackOverflow Go golangbridge 这几个比较活跃,话题都能得到即时回复。 国内的: golangtc gocn studygolang golang-china
目前来讲不建议用go开发ui程序。可以有折中选择,比如main程序是go,然后利用go可以自然调用C代码的能力,在C代码中写ui部分。ui部分用c/c++可以选择的东西就比较多了,比如wxWidget、qt等。&br&&br&UPDATE():最近也简单看了下go下面gui库的进展,我觉得 &a href=&///?target=http%3A///lxn/walk& class=& external& target=&_blank& rel=&nofollow noreferrer&&&span class=&invisible&&http://&/span&&span class=&visible&&/lxn/walk&/span&&span class=&invisible&&&/span&&i class=&icon-external&&&/i&&/a& 是成熟度最高的,如果希望纯粹用go的话,可以一试。我刚刚跑了下样例,结果 win7 下可以,xp 下失败,提了个 issue,作者几十分钟内就 fix 了,很负责。
目前来讲不建议用go开发ui程序。可以有折中选择,比如main程序是go,然后利用go可以自然调用C代码的能力,在C代码中写ui部分。ui部分用c/c++可以选择的东西就比较多了,比如wxWidget、qt等。 UPDATE():最近也简单看了下go下面gui库的进展,我觉得 …
IDEs and Plugins for Go&ul&&li&&a href=&///?target=http%3A//www.atom.io/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Atom&i class=&icon-external&&&/i&&/a&: JavaScript-based editor from GitHub. Go support at &a href=&///?target=https%3A///joefitzgerald/go-plus& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&go-plus&i class=&icon-external&&&/i&&/a&&/li&&li&&a href=&///?target=http%3A///products/bbedit/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&BBedit&i class=&icon-external&&&/i&&/a&: commercial text editor for OS X.&ul&&li&Basic Go support available with the module &a href=&///?target=http%3A///extensions/Go.plist.zip& class=& external& target=&_blank& rel=&nofollow noreferrer&&&span class=&invisible&&http://&/span&&span class=&visible&&/exte&/span&&span class=&invisible&&nsions/Go.plist.zip&/span&&span class=&ellipsis&&&/span&&i class=&icon-external&&&/i&&/a&&/li&&li&&a href=&///?target=https%3A///ascarter/go-bbpackage& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Go-bbpackage&i class=&icon-external&&&/i&&/a& with clippings, ctags standard library completion, better syntax highlighting, and tools&/li&&/ul&&/li&&li&&p&&a href=&///?target=http%3A//brackets.io/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Brackets&i class=&icon-external&&&/i&&/a&: a modern, open source text editor that understands web design.&/p&&ul&&li&&a href=&///?target=https%3A///David5i6/Brackets-Go-IDE& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&go-ide&i class=&icon-external&&&/i&&/a& Go support with autocompletion through gocode.&/li&&/ul&&/li&&li&&p&&a href=&///?target=https%3A//www.codebox.io/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Codebox IDE&i class=&icon-external&&&/i&&/a&: open-source cross-platform IDE, runs on desktop (Linux or OS X) and in the cloud with Go &a href=&///?target=https%3A//www.codebox.io/stack/go& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&support&i class=&icon-external&&&/i&&/a&&/p&&/li&&li&&a href=&///?target=https%3A///& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&CodeEnv&i class=&icon-external&&&/i&&/a&: A cloud-based IDE now includes &a href=&///?target=https%3A///env/codeenv/7/go/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&full Go support&i class=&icon-external&&&/i&&/a&.&/li&&li&&a href=&///?target=http%3A//www.eclipse.org/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Eclipse IDE&i class=&icon-external&&&/i&&/a&: a very popular, open-source, cross-platform IDE. &a href=&///?target=https%3A//goclipse.github.io/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&GoClipse&i class=&icon-external&&&/i&&/a& plugin enables Go support.&/li&&li&&a href=&///?target=https%3A//www.gnu.org/software/emacs/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Emacs&i class=&icon-external&&&/i&&/a&: Extensible and customizable text editor.&ul&&li&Mode file maintained at &a href=&///?target=https%3A///dominikh/go-mode.el& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&GitHub - dominikh/go-mode.el: Emacs mode for the Go programming language&i class=&icon-external&&&/i&&/a&.&/li&&li&&a href=&///?target=https%3A///dougm/goflymake& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&GoFlyMake&i class=&icon-external&&&/i&&/a& Flymake-style syntax checking for Go&/li&&li&&a href=&///?target=https%3A///dominikh/go-errcheck.el& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&go-errcheck.el&i class=&icon-external&&&/i&&/a& Errcheck integration for Emacs&/li&&/ul&&/li&&li&&a href=&///?target=http%3A//projects.gnome.org/gedit/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Gedit&i class=&icon-external&&&/i&&/a&: Official text editor for the GNOME Desktop. &a href=&///?target=https%3A//bitbucket.org/fzzbt/go-gedit-plugin/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Plugin for Auto-Completion and Code-Formatting available&i class=&icon-external&&&/i&&/a&.&/li&&li&&a href=&///?target=http%3A//www.geany.org/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Geany&i class=&icon-external&&&/i&&/a&: Geany is a text editor using the GTK2 toolkit with basic features of an integrated development environment. Supports Go syntax highlighting out of the box.&/li&&li&&a href=&///?target=https%3A///nsf/gocode& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Gocode&i class=&icon-external&&&/i&&/a&: An autocompletion daemon that includes support for emacs and vim.&/li&&li&&a href=&///?target=https%3A///rogpeppe/godef& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&godef&i class=&icon-external&&&/i&&/a&: Prints the source location of definitions in Go programs. Integrates with acme, emacs, vim and SublimeText.&/li&&li&&a href=&///?target=https%3A///jstemmer/gotags& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Gotags&i class=&icon-external&&&/i&&/a&: Generates ctags-compatible tag files&/li&&li&&a href=&///?target=http%3A///products/demo/goworks& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&GoWorks&i class=&icon-external&&&/i&&/a&: &a href=&///?target=http%3A//netbeans.org/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&NetBeans&i class=&icon-external&&&/i&&/a& based open source Go IDE.&/li&&li&&a href=&///?target=http%3A///idea/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&IntelliJ IDEA&i class=&icon-external&&&/i&&/a&: Commercial cross-platform IDE, &a href=&///?target=http%3A///idea/download/index.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&free Community Edition available&i class=&icon-external&&&/i&&/a&. &a href=&///?target=https%3A///plugin/%3Fid%3D5047& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Open-Source plugin for Go&i class=&icon-external&&&/i&&/a& support available. All derivative platforms of IntelliJ (PyCharm, PhpStorm et al.) are supported. Nightly / alpha builds available at &a href=&///?target=https%3A///go-lang-plugin-org/go-lang-idea-plugin& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&plugin repository&i class=&icon-external&&&/i&&/a&&/li&&li&&a href=&///?target=http%3A//www.jedit.org/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&jEdit&i class=&icon-external&&&/i&&/a&: open-source, cross-platform text editor written in Java. &a href=&///?target=http%3A///p/go-stuff/source/browse/editors/jEdit/go.xml& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Syntax-highlighting file available&i class=&icon-external&&&/i&&/a&.&/li&&li&&a href=&///?target=http%3A//joe-editor.sourceforge.net/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&joe&i class=&icon-external&&&/i&&/a&: JOE is a full featured terminal-based screen editor which is distributed under the GNU General Public License (GPL). Supports Go syntax highlighting out of the box.&/li&&li&&a href=&///?target=http%3A///go/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Komodo IDE&i class=&icon-external&&&/i&&/a& Powerful cross-platform IDE with built-in Go support&/li&&li&&a href=&///?target=http%3A///komodo-edit/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Komodo Edit&i class=&icon-external&&&/i&&/a& Powerful cross-platform text editor, Go-lang support available via &a href=&///?target=https%3A///Komodo/komodo-go& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&plugin&i class=&icon-external&&&/i&&/a&&/li&&li&&a href=&///?target=http%3A//limetext.org/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Lime Text&i class=&icon-external&&&/i&&/a&: Developed in Go, aims to be a Free and open-source software alternative to Sublime Text. Not quite ready yet but welcoming contributions to the progress. &a href=&///?target=https%3A///limetext/lime& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&GitHub - limetext/lime: Open source API-compatible alternative to the text editor Sublime Text&i class=&icon-external&&&/i&&/a&&/li&&li&&a href=&///?target=https%3A///visualfc/liteide& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&LiteIDE&i class=&icon-external&&&/i&&/a&: A simple, open source and cross-platform Go IDE&/li&&li&&a href=&///?target=http%3A//notepad-plus-plus.org/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Notepad++&i class=&icon-external&&&/i&&/a&: Free source code editor for Windows.&ul&&li&&a href=&///?target=https%3A///chai2010/notepadplus-go& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&notepadplus-go&i class=&icon-external&&&/i&&/a& Syntax highlighting, functions list panel (for code browsing), code completion for keywords & builtins.&/li&&li&The GOnpp plugin (available via Notepad++'s built-in Plugin Manager) provides code completion (requires gocode), function calltips, goimports integration, and keyboard shortcuts for common go commands. [&a href=&///?target=https%3A///tike/GOnpp& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&sources&i class=&icon-external&&&/i&&/a&, &a href=&///?target=http%3A//sourceforge.net/projects/gonpp/files/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&binaries&i class=&icon-external&&&/i&&/a&].&/li&&li&&a href=&///?target=https%3A///steve-perkins/GoAutocomplete& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&GoAutocomplete&i class=&icon-external&&&/i&&/a& is another code completion plugin.&/li&&/ul&&/li&&li&&a href=&///?target=http%3A///& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Sublime Text&i class=&icon-external&&&/i&&/a&: Commercial text editor. &a href=&///?target=https%3A///DisposaBoy/GoSublime& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Plugin collection with IDE-like features available&i class=&icon-external&&&/i&&/a&.&/li&&li&&a href=&///?target=http%3A///textadept/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Textadept&i class=&icon-external&&&/i&&/a&: Textadept is a fast, minimalist, and remarkably extensible cross-platform text editor. Supports Go syntax highlighting out of the box.&/li&&li&&a href=&///?target=http%3A///& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&TextMate&i class=&icon-external&&&/i&&/a&: Commercial text editor for OS X. &a href=&///?target=https%3A///textmate/textmate& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Source code available&i class=&icon-external&&&/i&&/a& under the GPLv3. &a href=&///?target=https%3A///syscrusher/golang.tmbundle& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Bundle for Go available&i class=&icon-external&&&/i&&/a&.&/li&&li&&a href=&///?target=http%3A///products/textwrangler/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&TextWrangler&i class=&icon-external&&&/i&&/a&: free &em&little brother&/em& of BBedit. Both the Go module and Go.bbpackage for BBedit work for TextWrangler as well.&/li&&li&&a href=&///?target=http%3A//www.vim.org/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Vim&i class=&icon-external&&&/i&&/a& & &a href=&///?target=https%3A//neovim.io/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Neovim&i class=&icon-external&&&/i&&/a&: Vi Improved. There are a number of plugins available that make editing Go code easier.&ul&&li&The &a href=&///?target=https%3A///fatih/vim-go& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&vim-go&i class=&icon-external&&&/i&&/a& plugin includes misc/vim and has many other new improvements.&/li&&li&The &a href=&///?target=https%3A///scrooloose/syntastic& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Syntastic&i class=&icon-external&&&/i&&/a& plugin gives instant feedback on compile errors&/li&&li&The &a href=&///?target=https%3A///majutsushi/tagbar& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&tagbar&i class=&icon-external&&&/i&&/a& plugin uses Gotags, above, to show an outline of the current file&/li&&li&A &a href=&///?target=https%3A///rjohnsondev/vim-compiler-go& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&vim compiler plugin&i class=&icon-external&&&/i&&/a& for syntax checking&/li&&li&A &a href=&///?target=https%3A///dgryski/vim-godef& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&vim-godef&i class=&icon-external&&&/i&&/a& plugin integrates with the 'godef' tool, above&/li&&li&A &a href=&///?target=https%3A///vim-jp/vim-go-extra& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&vim-go-extra&i class=&icon-external&&&/i&&/a& is vim plugin based on misc/vim in go repository. This works fine on windows too!&/li&&/ul&&/li&&li&&a href=&///?target=https%3A///& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Visual Studio&i class=&icon-external&&&/i&&/a&: Commercial IDE by Microsoft for Windows. A &a href=&///?target=https%3A//visualstudiogallery./bd7675ba-1bf5-a-4fc19dfc0d76& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Go Language Support&i class=&icon-external&&&/i&&/a&extension is available for Visual Studio
and 2013 Pro, Enterprise, and Community.&/li&&li&&a href=&///?target=https%3A///& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Visual Studio Code&i class=&icon-external&&&/i&&/a&: Recently launched in Preview, Visual Studio Code supports Go syntax highlighting out of the box. Additional features are provided by the &a href=&///?target=https%3A///Microsoft/vscode-go& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&vscode-go&i class=&icon-external&&&/i&&/a& plugin.&/li&&li&&a href=&///?target=http%3A//golang.cat-v.org/text-editors/nano/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&GNU Nano&i class=&icon-external&&&/i&&/a&: a simple .nanorc for GNU Nano (&pico&).&/li&&li&&a href=&///?target=http%3A///go.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Zeus&i class=&icon-external&&&/i&&/a&: Commercial IDE for Go (Windows or Linux with Wine).&/li&&li&&a href=&///?target=https%3A///b3log/wide& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Wide&i class=&icon-external&&&/i&&/a&: A Web-based IDE for Teams using Go programming language/Golang&/li&&/ul&
IDEs and Plugins for Go: JavaScript-based editor from GitHub. Go support at : commercial text editor for OS X.Basic Go support available with the module
Python虽然也是跨平台,它丰富的库反而成了跨平台部署桎梏,我看过一个做银行特色业务的实施过程,为了把引用的三方库的应用程序部署在一台内网Linux服务器上,花了三个多小时,我在看完部署过程后,想了想如果是操作很熟练至少也得半小时左右,如此复杂的部署,又是并不能随时停掉的系统,如果有版本bug或漏洞会让升级维护很麻烦。&br&如果是go语言部署的话完全不会有这种麻烦,生产机直接上传二进制文件,跨服迁移代码直接copy过去。&br&而且go语言的库现在不仅多,而且库升级兼容性很好。&br&自带的net,http,template完全可以做一个Web应用程序,性能还相当不错。&br&还有各种数据库的连接库,pdf,excel生成库等,当然像Python那种各式各样的库的确不够,毕竟时间轴在那儿,但缺少的自己可以写嘛。&br&至于学习曲线,go的确要难一点,但无论是性能还是后期维护,就会觉得多花一些时间学习真的很值。
Python虽然也是跨平台,它丰富的库反而成了跨平台部署桎梏,我看过一个做银行特色业务的实施过程,为了把引用的三方库的应用程序部署在一台内网Linux服务器上,花了三个多小时,我在看完部署过程后,想了想如果是操作很熟练至少也得半小时左右,如此复杂的…
如果有其他选择,别用Node.js,没有选择的话Node.js凑合用着吧,用Node.js你的业务逻辑会IO分割的支离破碎,写这些代码的时候已经很难受了,维护起来你自己想想吧。&br&&br&Node.js发生内存泄漏找起来也是好难受的。&br&&br&协议选择websocket并不是太明智,你知道移动网络并没有你想的那么快,别上线了才发现卡的要死,想着要换协议,或者压缩协议,并不是那么舒服的事情。&br&&br&顺便黑一下学了Node.js就号称全栈工程师的人,他们是不可靠的。&br&&br&未来趋势绝对不是Node.js这种一个回调接一个回调的玩法,太反人类。&br&&br&选择你擅长的,你擅长Node.js就用Node.js吧,虽然我黑了那么多。&br&&br&说一下,我用过比Node.js好的方案(至少写起来好,别和我说什么性能,大多手游服务对性能并没有太高的要求)&br&python+ gevent + protobuf&br&云风的skynet
如果有其他选择,别用Node.js,没有选择的话Node.js凑合用着吧,用Node.js你的业务逻辑会IO分割的支离破碎,写这些代码的时候已经很难受了,维护起来你自己想想吧。 Node.js发生内存泄漏找起来也是好难受的。 协议选择websocket并不是太明智,你知道移动网…
已有帐号?
无法登录?
社交帐号登录}

我要回帖

更多关于 go vs nodejs 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信