The Go Programming Language


The Go Programming Language



Go is an open source programming environment that makes it easy to build simple, reliable, and efficient software.
The Go programming language is an open source project to make programmers more productive.
Go is outgoing, crisp, clean, and competent. Its concurrency mechanism make it easy to write down programs that obtain the most out of multicore and networked machines, at the same time as its novel type system enable flexible and modular program structure. Go compiles fast to machine code nevertheless has the ease of garbage collection and the control of run-time expression. It's a fast, statically typed, compiled language that feels similar to a dynamically typed, interpreted language.Go is an open source project with a BSD-style license. There are two official Go compiler toolchains: the gc Go compiler and the gccgo compiler that is part of the GNU C Compiler (GCC).The gc compiler is the more established and well-tested of the two.The gc compiler supports the subsequent operating systems and architectures. Please make sure your system meets these necessities before proceeding. If your OS or architecture is not on the list, it's possible that gccgo might support your setup; see Setting up and using gccgo for details.
Operating system Architectures Notes
FreeBSD 7 or later amd64, 386 Debian GNU/kFreeBSD not supported
Linux 2.6.23 or later with glibc amd64, 386, arm CentOS/RHEL 5.x not supported; no binary distribution for ARM yet
Mac OS X 10.6/10.7 amd64, 386 use the gcc† that comes with Xcode
Windows 2000 or later amd64, 386 use mingw gcc†; cygwin or msys is not needed


The commands are:

build compile packages and dependencies
clean remove object files
doc run godoc on package sources
env print Go environment information
fix run go tool fix on packages
fmt run gofmt on package sources
get download and install packages and dependencies
install compile and install packages and dependencies
list list packages
run compile and run Go program
test test packages
tool run specified go tool
version print Go version
vet run go tool vet on packages


Effective Go

Go is a latest language. Even though it borrows ideas from existing languages, it has extraordinary properties that make efficient Go programs different in nature from programs written in its relatives. A simple translation of a C++ or Java program into Go is doubtful to produce a satisfactory result—Java programs are written in Java, not Go. On the other hand, thinking about the problem from a Go viewpoint could construct a successful but quite different program. In other words, to write Go well, it's important to appreciate its properties and idioms. It's also significant to know the recognized convention for programming in Go, such as naming, formatting, program construction, and so on, so that programs you write will be simple for other Go programmers to recognize.


What is the purpose of the project?

No major systems language has emerged in over a decade, but over that time the computing landscape has changed tremendously. There are several trends:
  • Computers are enormously quicker but software development is not faster.
  • Dependency management is a big part of software development today but the "header files" of languages in the C tradition are antithetical to clean dependency analysis—and fast compilation.
  • There is a growing rebellion against cumbersome type systems like those of Java and C++, pushing people towards dynamically typed languages such as Python and JavaScript.
  • Some fundamental concepts such as garbage collection and parallel computation are not well supported by popular systems languages.
  • The emergence of multicore computers has generated worry and confusion.
We believe it's worth trying again with a new language, a concurrent, garbage-collected language with fast compilation. Regarding the points above:
  • It is possible to compile a large Go program in a few seconds on a single computer.
  • Go provides a model for software construction that makes dependency analysis easy and avoids much of the overhead of C-style include files and libraries.
  • Go's type system has no hierarchy, so no time is spent defining the relationships between types. Also, although Go has static types the language attempts to make types feel lighter weight than in typical OO languages.
  • Go is fully garbage-collected and provides fundamental support for concurrent execution and communication.
  • By its design, Go proposes an approach for the construction of system software on multicore machines.


History of the Project

Robert Griesemer, Rob Pike and Ken Thompson started sketching the goals for a new language on the white board on September 21, 2007. Within a few days the goals had settled into a plan to do something and a fair idea of what it would be. Design continued part-time in parallel with unrelated work. By January 2008, Ken had started work on a compiler with which to explore ideas; it generated C code as its output. By mid-year the language had become a full-time project and had settled enough to attempt a production compiler. In May 2008, Ian Taylor independently started on a GCC front end for Go using the draft specification. Russ Cox joined in late 2008 and helped move the language and libraries from prototype to reality. Go became a public open source project on November 10, 2009. Many people from the community have contributed ideas, discussions, and code.


Go's ancestors

Go is mostly in the C family (basic syntax), with significant input from the Pascal/Modula/Oberon family (declarations, packages), plus some ideas from languages inspired by Tony Hoare's CSP, such as Newsqueak and Limbo (concurrency). However, it is a new language across the board. In every respect the language was designed by thinking about what programmers do and how to make programming, at least the kind of programming we do, more effective, which means more fun.There are now several Go programs deployed in production inside Google. A public example is the server behind http://golang.org. It's just the godoc document server running in a production configuration on Google App Engine.


Is Go an object-oriented language?

Yes and no. Although Go has types and methods and allows an object-oriented style of programming, there is no type hierarchy. The concept of “interface” in Go provides a different approach that we believe is easy to use and in some ways more general. There are also ways to embed types in other types to provide something analogous—but not identical—to subclassing. Moreover, methods in Go are more general than in C++ or Java: they can be defined for any sort of data, even built-in types such as plain, “unboxed” integers. They are not restricted to structs (classes).Also, the lack of type hierarchy makes “objects” in Go feel much more lightweight than in languages such as C++ or Java.


How are libraries documented?

There is a program, godoc, written in Go, that extracts package documentation from the source code. It can be used on the command line or on the web. An instance is running at http://golang.org/pkg/. In fact, godoc implements the full site at http://golang.org/.


Hello World in Go

package main
import "fmt"
func main() {
            fmt.Println("Hello, World!")
}

Go Language Website

http://golang.org/
Here you can see the Website. It should show everything you want to know about Go Lang.

10 comments:

Disqus for Web Expert