Go 에서 함수는 다중 반환값을 허용한다!
조금 생소하지만 편리해 보인다.
package main
import "fmt"
type BlogDto struct {
Id int
Title string
Owner string
}
func main() {
dto := BlogDto{
Id: 1,
Title: "Phoenix",
Owner: "개발조아",
}
profile, comment := BlogProfile(dto)
fmt.Println("내 블로그 소개", profile, comment)
}
func BlogProfile(dto BlogDto) (string, string) {
return "\nid : " + fmt.Sprint(dto.Id) + "\n제목 : " + dto.Title + "\n필자 : " + dto.Owner,
"\n\n화이팅 합시다!"
}