TelenkovDmitry 1 éve
szülő
commit
0aafda8982
4 módosított fájl, 49 hozzáadás és 0 törlés
  1. 3 0
      go/server/go.mod
  2. 15 0
      go/server/main.go
  3. 3 0
      go/simple-app/go.mod
  4. 28 0
      go/simple-app/main.go

+ 3 - 0
go/server/go.mod

@@ -0,0 +1,3 @@
+module server
+
+go 1.22.1

+ 15 - 0
go/server/main.go

@@ -0,0 +1,15 @@
+package main
+
+import (
+	"fmt"
+	"net/http"
+)
+
+func Index(w http.ResponseWriter, r *http.Request) {
+	fmt.Fprintf(w, "Hello world")
+}
+
+func main() {
+	http.HandleFunc("/", Index)
+	http.ListenAndServe(":9000", nil)
+}

+ 3 - 0
go/simple-app/go.mod

@@ -0,0 +1,3 @@
+module simple-app
+
+go 1.22.1

+ 28 - 0
go/simple-app/main.go

@@ -0,0 +1,28 @@
+package main
+
+import (
+	"fmt"
+)
+
+func main() {
+	/*
+		http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
+			fmt.Fprintf(w, "Hello world")
+		})
+		http.ListenAndServe(":9000", nil)
+	*/
+	test2()
+}
+
+func test1() {
+	var name string = "Dmitry"
+	var age int = 23
+	var c = fmt.Sprintf("My name is %s and ma age is %d", name, age)
+	fmt.Println(c)
+}
+
+func test2() {
+	for i := 0; i < 10; i++ {
+		fmt.Println(i)
+	}
+}