diff --git a/go/l19/l1.go b/go/l19/l1.go index a3c84d4..b032ca7 100644 --- a/go/l19/l1.go +++ b/go/l19/l1.go @@ -4,6 +4,7 @@ import ( "fmt" "net/http" "encoding/json" + "strings" ) type User struct{ diff --git a/go/l19/l2.go b/go/l19/l2.go index fda68d4..a87b1a1 100644 --- a/go/l19/l2.go +++ b/go/l19/l2.go @@ -15,11 +15,25 @@ type UserStruct struct{ Email string `json:"email"` } +func polz() (int, string, string) { + fmt.Printf("Your age? ") + var age int + fmt.Scan(&age) + fmt.Printf("Your name? ") + var name string + fmt.Scan(&name) + fmt.Printf("Your email? ") + var email string + fmt.Scan(&email) + return age, name, email +} + func main() { + age, name, email := polz() user := UserStruct{ - Age: 66, - Name: "Sergey", - Email: "Likhodeev.60@mail.ru", + Age: age, + Name: name, + Email: email, } JsonData, err := json.Marshal(user) if err != nil { @@ -42,4 +56,4 @@ func main() { } fmt.Printf("status code %d\n", resp.StatusCode) fmt.Println(string(body)) -} \ No newline at end of file +} diff --git a/go/l19/output/l1 b/go/l19/output/l1 index 9d9acb7..07a934c 100755 Binary files a/go/l19/output/l1 and b/go/l19/output/l1 differ diff --git a/go/l19/output/l2 b/go/l19/output/l2 new file mode 100755 index 0000000..23e5571 Binary files /dev/null and b/go/l19/output/l2 differ