Initial commit
commit
414642145f
@ -0,0 +1,37 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import "fmt"
|
||||||
|
|
||||||
|
type Veicolo interface {
|
||||||
|
parti()
|
||||||
|
}
|
||||||
|
|
||||||
|
type Macchina struct {
|
||||||
|
NumeroPorte int
|
||||||
|
Propietario string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Macchina) parti() {
|
||||||
|
fmt.Println("La macchina e' partita")
|
||||||
|
}
|
||||||
|
|
||||||
|
type Camion struct {
|
||||||
|
Peso int
|
||||||
|
Propietario string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Camion) parti() {
|
||||||
|
fmt.Println("Il camion e' partito")
|
||||||
|
}
|
||||||
|
|
||||||
|
func muoviMezzo(v Veicolo) {
|
||||||
|
v.parti()
|
||||||
|
}
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
m := &Macchina{NumeroPorte: 5, Propietario: "Boh"}
|
||||||
|
muoviMezzo(m)
|
||||||
|
|
||||||
|
c := &Camion{Peso: 1000, Propietario: "Boh"}
|
||||||
|
muoviMezzo(c)
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Prova</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>PAgina!</h1>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -0,0 +1,23 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
http.HandleFunc("/a", func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
http.ServeFile(w, r, "./index.html")
|
||||||
|
})
|
||||||
|
http.HandleFunc("/b", func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
w.Write([]byte("B"))
|
||||||
|
})
|
||||||
|
|
||||||
|
fmt.Println("Listening on port 8080")
|
||||||
|
err := http.ListenAndServe(":8080", nil)
|
||||||
|
if err != nil {
|
||||||
|
panic(err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Println("Stopped!")
|
||||||
|
}
|
Loading…
Reference in New Issue