Go: Difference between revisions

From Rixort Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 38: Line 38:
Names in packages are exported if they begin with a capital letter.
Names in packages are exported if they begin with a capital letter.


== Resources ==
== Articles ==


* [https://github.com/enocom/gopher-reading-list A Gopher's Reading List]
* [https://github.com/enocom/gopher-reading-list A Gopher's Reading List]
* [https://medium.com/@IndianGuru/best-practices-for-a-new-go-developer-8660384302fc Best practices for a new Go developer]
== Talks ==
* [http://talks.golang.org/2012/splash.article Go at Google: Language Design in the Service of Software Engineering]
* [https://talks.golang.org/2015/go-for-java-programmers.slide Go for Java Programmers]
== Tutorials ==
* [http://learnxinyminutes.com/docs/go/ Learn Go in Y minutes]
* [https://gobyexample.com/ Go by example]
* [http://tour.golang.org/welcome/1 A tour of Go]
* [http://golang.org/doc/effective_go.html Effective Go]


== Books ==
== Books ==

Revision as of 11:33, 15 April 2018

Variables

Variables are defined as:

var name type = value

For example:

var x string = "Hello"

The type can be inferred if an initial value is given, e.g.

var x = "Hello"

or by using the := operator:

x := "Hello"

Constants can be defined by using the const keyword instead of var.

Loops

Go only supports the for loop - unlike other languages it lacks while, do while etc. However, it is possible to emulate other loop constructs using for.

Imports

Standard import notation:

import "fmt"

Multiple imports can be done either one line at a time or as a group:

import (
  "fmt"
  "math"
)

Names in packages are exported if they begin with a capital letter.

Articles

Talks

Tutorials

Books