Go Printf("%#v")

1 개요[ | ]

Go Printf("%#v")
package main

import "fmt"

func main() {
	a := 1
	b := "hello"
	fmt.Printf("%#v\n", a) // 1
	fmt.Printf("%#v\n", b) // "hello"
}
package main

import "fmt"

func main() {
	nums := []int{1, 2, 3}
	fruits := []string{"apple", "banana", "melon"}
	fmt.Printf("%#v\n", nums)   // []int{1, 2, 3}
	fmt.Printf("%#v\n", fruits) // []string{"apple", "banana", "melon"}
}
package main

import "fmt"

type person struct {
	name string
	age  int
}

func main() {
	p := person{name: "John", age: 42}
	fmt.Printf("%#v\n", p) // main.person{name:"John", age:42}
}

2 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}