migration gitea

This commit is contained in:
Antoine 2018-11-04 13:03:27 +01:00
commit a327673cd4
2 changed files with 66 additions and 0 deletions

22
employee/employee.go Normal file
View File

@ -0,0 +1,22 @@
package employee
import (
"fmt"
)
type employee struct {
firstName string
lastName string
totalLeaves int
leavesTaken int
}
// New constructeur d'employee
func New(firstName string, lastName string, totalLeave int, leavesTaken int) (e employee) {
e = employee{firstName, lastName, totalLeave, leavesTaken}
return
}
func (e employee) LeavesRemaining() {
fmt.Printf("%s %s has %d leaves remaining \n", e.firstName, e.lastName, (e.totalLeaves - e.leavesTaken))
}

44
test.go Normal file
View File

@ -0,0 +1,44 @@
package main
import (
"fmt"
//mathRand "math/rand"
cryptoRand "crypto/rand"
"math/big"
"time"
"main/employee"
)
var a, b int = 1, 2
func main() {
fmt.Println("a+b : ", a+b)
fmt.Println("Hello, :D ")
fmt.Println("Hello, playground", time.Now())
nBig, err := cryptoRand.Int(cryptoRand.Reader, big.NewInt(27))
if err != nil {
panic(err)
}
n := nBig.Int64()
//b := []byte{0}
//r := cryptoRand.Reader.Read(b)
fmt.Printf("r (%T) %d\n", n, n)
//fmt.Println("Random", mathRand.Seed(r).Intn(9))
e := employee.New("antoine", "roux", 10, 5)
e.LeavesRemaining()
}
// bool
// string
// int int8 int16 int32 int64
// uint uint8 uint16 uint32 uint64 uintptr
// byte // alias for uint8
// rune // alias for int32
// // represents a Unicode code point
// float32 float64
// complex64 complex128