Skip to content

Commit

Permalink
Adding go project
Browse files Browse the repository at this point in the history
  • Loading branch information
jefersonm committed Apr 17, 2017
1 parent 1bc4394 commit 5eaf4f7
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 0 deletions.
14 changes: 14 additions & 0 deletions techs/go/my_workspace/.gitignore
@@ -0,0 +1,14 @@
# Binaries for programs and plugins
*.exe
*.dll
*.so
*.dylib

# Test binary, build with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Project-local glide cache, RE: https://github.com/Masterminds/glide/issues/736
.glide/
4 changes: 4 additions & 0 deletions techs/go/my_workspace/README.md
@@ -0,0 +1,4 @@
Tutorial: https://tour.golang.org

Continue here: https://tour.golang.org/flowcontrol/1

Binary file added techs/go/my_workspace/src/hello/hello
Binary file not shown.
58 changes: 58 additions & 0 deletions techs/go/my_workspace/src/hello/hello.go
@@ -0,0 +1,58 @@
package main

import "fmt"

func sum(valOne, valTwo int) int {
return valOne + valTwo
}

func swap(x, y string) (string, string) {
return y, x
}

//naked return
func split(sum int) (x, y int) {
x = sum * 4 / 9
y = sum - x
return
}

func defaultValues() {
var i int
var f float64
var b bool
var s string
fmt.Printf("%v %v %v %q\n", i, f, b, s)
}

func conversion() {
var i int = 42
var f float64 = float64(i)
var u uint = uint(f)
fmt.Println(i, f, u)
}

//initializing variables, no type needed
var c, python = true, "no!"
const Pi = 3.14

func main() {
fmt.Printf("sum: %d \n", sum(1, 4))

nameOne, nameTwo := swap("Jeff", "Mateus")
fmt.Printf("names: %s, %s \n", nameOne, nameTwo)

x, y := split(17)
fmt.Printf("split values: %d, %d \n", x, y)

var i int
//short variable declaration
k := 3
fmt.Println(i, c, python, k)

defaultValues()

conversion()

fmt.Println("Happy", Pi, "Day")
}

0 comments on commit 5eaf4f7

Please sign in to comment.