Sonntag, 15. November 2009


Here is some introduction to new Google programing language.

At first go has his design to build a fast compiling system programming language for fast application. There is no mess with Java or C#/C++. go has no inheritance, but interfaces.

simple tutorial can be found on

At first the question: why yet another language?
google need a language which is fast in compiling and runing. Has the advantages of typing but not overloaded wiht oop stuff.

simple example:

// define the namespace
package main

// import the formated print package
// import fmt "fmt";

// import a couple of packages
import (
"flag"; // flag package is a good replacament for main(int argc, char **args) and
// replace the argument calculation with getopt() and switch. then create
// a help function automatic.

// create a boolean variable from package flag and set the values
var blub = flag.Bool("g", false, "blub lubn blub")

// g => -g
// false => set it at first to false
// "blub..." => description in help switch

func main() {
// parse the arguments

// ask if the
if *blub {
fmt.Printf("blub was setted\n");
} else {
fmt.Printf("blub was not setted\n");

as you has see variables are defined with var

var v1 int;
var v2 string;
var v3 float;

for printing is there the package fmt: fmt.Printf(..)
then exists other methods as in C.

to compile:
6g file.go
6l file.6 -o file

for x86
8g file.go
8l file.8 -o file

to be continued ...


Keine Kommentare:

Kommentar veröffentlichen