You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
470 B
Go
27 lines
470 B
Go
package main
|
|
|
|
import (
|
|
"bufio"
|
|
"encoding/json"
|
|
"fmt"
|
|
"os"
|
|
)
|
|
|
|
func main() {
|
|
|
|
myMap := make(map[string]string)
|
|
|
|
inputReader := bufio.NewReader(os.Stdin)
|
|
fmt.Println("Please enter your name:")
|
|
name, _ := inputReader.ReadString('\n')
|
|
|
|
myMap["name"] = name[:len(name)-1]
|
|
fmt.Println("Please enter your address:")
|
|
address, _ := inputReader.ReadString('\n')
|
|
|
|
myMap["address"] = address[:len(address)-1]
|
|
|
|
barr, _ := json.Marshal(myMap)
|
|
fmt.Println(string(barr))
|
|
}
|