概述struts
Google Engineers — Rob Pike, Robert Griesemer and Ken Thompson — began the process of designing a statically typed programming language, in 2007, with the goal of creating a simplistic syntax to securely take advantage of multi-core processors. It was designed as a solution for unnecessary complexities in other languages — C++ and Java — combining favorable features of C, Pascal, Modula and Oberon including aspects of Tony Hoare’s CSP, with the intent of efficient compilation, efficient execution and ease of programming all in one syntax. In mid-2008, Ian Taylor began work on the GNU Compiler Collection front end with major contributions provided by Russ Cox.
摹oogle工程师-罗勃·派克,罗伯特·格里瑟默和肯·汤普森-开始设计的过程中静态类型的编程语言,在2007年,与创建一个简单的语法来安全地利用的目标,多核心处理器。 它被设计为解决其他语言(C ++和Java)中不必要的复杂性的解决方案,结合了C,Pascal,Modula和Oberon的有利功能,包括Tony Hoare CSP的各个方面,旨在高效地编译,高效执行和简化编程。一种语法。 在2008年中,Ian Taylor在Russ Cox的大力支持下开始了GNU编译器集合前端的工作。
O n November 10, 2009 — Google publicly announced its release of the open source project — properly referred to as Go — however the first version becoming available in 2012. The moniker Golang stems from the domain — golang.org — which was selected as a result of go.org not being available. 2016 introduced the Gopher mascot — created by Renée French — along with a model sheet illustrating an accurate representation of unique characteristics. In modern day, Go has a community — in the millions — of programmers — gophers — from all over the world who have contributed to the project which has helped shape the current landscape of the language.
,O n 2009年11月10日-谷歌公开宣布其开源项目释放-适当地称为围棋-但是可用的第一个版本成为2012年的绰号Golang从域茎- golang.org -这被选为go.org的结果不可用。 2016年推出了由RenéeFrench创建的Gopher吉祥物,并附有模型表,可准确展示独特的特征。 在当今时代,Go拥有一个来自世界各地的程序员社区-数以百万计的地鼠,他们为该项目做出了贡献,该项目有助于塑造该语言的当前格局。
运行 (Run-time)
Go was inspired by the C programming language with an increase in security and the simplicity of dynamically typed languages such as JavaScript or Python. It comes with a run-time library built-in which employs features including — but not limited to — garbage collection, concurrency, and stack management.
Go受到C编程语言的启发,它提高了安全性并简化了动态类型语言(如JavaScript或Python)的使用。 它带有一个内置的运行时库,该库采用的功能包括但不限于垃圾收集,并发和堆栈管理。
Instead of threads — a light weight process attached to an operating system that’s responsible for executing the underlying code of an application — Go utilizes a function or a method known as a goroutine which independently and synchronously executes in relation to other goroutines present in your code — making it easier to use concurrency. Goroutines communicate through channels.
Go使用一种称为goroutine的函数或方法,而不是线程-附加到操作系统的轻量进程来执行应用程序的基础代码。 相对于代码中存在的其他goroutine,它独立且同步地执行-简化了并发性。 Goroutine通过通道进行通信。
Essentially, the functions or methods execute onto a set of threads and when a goroutine is blocked — prevented from executing — the run-time moves its co-routines from the same operating system thread to a distributed thread which expedites blockage.
本质上,这些函数或方法在一组线程上执行,并且当goroutine被阻止(阻止执行)时,运行时会将其协同例程从同一操作系统线程移至分布式线程,从而加快了阻塞速度。
To prevent the stacks from growing large in size, the run-time library uses an enclosed stack which is resizable by a few kilobytes. It then increases — or decreases — the memory for storing the stack, which allows an overflow of goroutines in a moderate amount of memory, making it possible to construct an abundance of goroutines in the same address space.
为了防止堆栈变大,运行时库使用封闭的堆栈,该堆栈的大小可调整为几千字节。 然后,它增加了(或减少了)用于存储堆栈的内存,这允许在适当数量的内存中溢出goroutine,从而有可能在同一地址空间中构造大量goroutine。
种类 (Types)
In Go, everything is a type. Primitive types include: strings, boolean, integers, bytes, runes, floats and complex numbers. Although it is possible to use types and methods which allow for an object-oriented style of programming, there is no set order, so objects feel more lightweight than other languages.
在Go中,一切都是类型。 基本类型包括:字符串,布尔值,整数,字节,符文,浮点数和复数。 尽管可以使用允许采用面向对象编程风格的类型和方法,但是没有设置顺序,因此对象比其他语言更轻量。
Object-oriented programming in Go concentrates on the relationship between types. Instead of declaring which types are related in advance, a type will conciliate an interface according to the subset of its methods, making it possible to appease multiple interfaces.
Go中的面向对象编程专注于类型之间的关系。 一个类型将根据其方法的子集来调和一个接口,而不是预先声明哪些类型是相关的,从而可以安抚多个接口。
Interfaces in Go can be described as a definition which characterizes the type that another type must possess. They allow for polymorphism — a single interface which accepts entities of two separate types. An empty interface does not have methods, allowing every type to satisfy.
介面 Go中的可以描述为定义另一个类型必须拥有的类型的定义。 它们允许多态性-单个接口可以接受两种不同类型的实体。 空接口没有方法,允许每种类型都满足。
Everything in Go is also pass by value, meaning the function will always receive a copy of whatever is passed in as a parameter.
Go中的所有内容也都按值传递,这意味着该函数将始终接收作为参数传递的内容的副本。
错误处理 (Error Handling)
Go is not designed with exceptions built into it. Instead, errors are values which make it possible . In terms of standard error handling, Functions and methods can return multi-values which conveniently outputs an error without overwhelming the value returned. It also comes with functions — such as Defer, Panic, and Recover — to signal and recover from unique conditions which executes as part of a function’s state breaking down an error, resulting in clean error-handling.
Go的设计没有内置异常。 相反,错误是使之成为可能的值。 在标准错误处理方面,函数和方法可以返回多值,从而方便地输出错误而不会压倒返回的值。 它还带有Defer , Panic和Recover之类的函数,用于发信号并从独特的条件中恢复,这些条件作为函数状态的一部分执行以分解错误,从而进行干净的错误处理。
入门 (Getting Started)
概述struts