From e6336ed54ddf786b09232b1a6b021d64aadb6d60 Mon Sep 17 00:00:00 2001 From: hoang Date: Sun, 24 May 2020 11:00:21 +0700 Subject: [PATCH] read.go init value with constrain --- c1-m4-activity/read.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/c1-m4-activity/read.go b/c1-m4-activity/read.go index ced4552..dadb5ca 100644 --- a/c1-m4-activity/read.go +++ b/c1-m4-activity/read.go @@ -59,7 +59,8 @@ func main() { text := scanner.Text() for pos, char := range []byte(text) { if char == ' ' { - names = append(names, Name{string(text[:pos]), string(text[pos+1:])}) + tempName := Name{string(text[:pos]), string(text[pos+1:])} + names = append(names, tempName) } } }