Go 타입 별칭

(Go type alias에서 넘어옴)

1 개요[ | ]

Go type alias
Go 타입 별칭

2 int 예시[ | ]

Go
CPU
-1.0s
MEM
-0M
-1.0s
Copy
package main

import (
	"fmt"
	"reflect"
)

type MyIntType int

func main() {
	var x MyIntType = 123
	fmt.Println(reflect.TypeOf(x))
}
main.MyIntType

3 string 예시[ | ]

Go
Copy
package main

import (
	"fmt"
	"reflect"
)

type MyStringType string

func main() {
	var x MyStringType = "hello"
	fmt.Println(reflect.TypeOf(x))
}
Loading

4 같이 보기[ | ]

5 참고[ | ]