update for work status go/l19
This commit is contained in:
parent
5d22bef418
commit
b860e1acb6
4 changed files with 19 additions and 4 deletions
|
|
@ -4,6 +4,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
type User struct{
|
type User struct{
|
||||||
|
|
|
||||||
20
go/l19/l2.go
20
go/l19/l2.go
|
|
@ -15,11 +15,25 @@ type UserStruct struct{
|
||||||
Email string `json:"email"`
|
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() {
|
func main() {
|
||||||
|
age, name, email := polz()
|
||||||
user := UserStruct{
|
user := UserStruct{
|
||||||
Age: 66,
|
Age: age,
|
||||||
Name: "Sergey",
|
Name: name,
|
||||||
Email: "Likhodeev.60@mail.ru",
|
Email: email,
|
||||||
}
|
}
|
||||||
JsonData, err := json.Marshal(user)
|
JsonData, err := json.Marshal(user)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
BIN
go/l19/output/l1
BIN
go/l19/output/l1
Binary file not shown.
BIN
go/l19/output/l2
Executable file
BIN
go/l19/output/l2
Executable file
Binary file not shown.
Loading…
Reference in a new issue