[Go] basics and web
This commit is contained in:
62
slides/go/main.go
Normal file
62
slides/go/main.go
Normal file
@@ -0,0 +1,62 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
|
||||
type Point struct {
|
||||
x int
|
||||
y int
|
||||
}
|
||||
|
||||
type Boja int
|
||||
|
||||
const (
|
||||
plava = iota //asc
|
||||
zuta
|
||||
crvena
|
||||
)
|
||||
|
||||
const (
|
||||
plava = iota << 1
|
||||
zuta // 010
|
||||
crvena // 100
|
||||
)
|
||||
|
||||
type Vektor2d struct {
|
||||
x int
|
||||
y int
|
||||
}
|
||||
|
||||
type Vektor3d struct {
|
||||
x ,y, z int
|
||||
}
|
||||
|
||||
type(p Point) D
|
||||
|
||||
|
||||
type Vektor interface {
|
||||
Duzina() float32
|
||||
}
|
||||
|
||||
|
||||
func main() {
|
||||
|
||||
p:= Vektor2d[
|
||||
x:1,
|
||||
y:1
|
||||
]
|
||||
|
||||
fmt.Println(p.)
|
||||
// web server
|
||||
|
||||
http.HandleFunc("/", a )
|
||||
http.ListenAndServe(":8080", nil)
|
||||
|
||||
}
|
||||
|
||||
func a(w http.ResponseWriter, r *http.Request){
|
||||
w.Write([]byte("Hello Web"))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user