"Go version"의 두 판 사이의 차이

 
(같은 사용자의 중간 판 8개는 보이지 않습니다)
5번째 줄: 5번째 줄:
* Go 버전을 출력하는 go 명령어
* Go 버전을 출력하는 go 명령어


==현재 환경의 Go 버전 (기본)==
<syntaxhighlight lang='console'>
<syntaxhighlight lang='console'>
root@centos7:~# go version
root@wsl:~# go version
go version go1.12.7 linux/amd64
go version go1.24.5 linux/amd64
</syntaxhighlight>
</syntaxhighlight>
==바이너리의 Go 버전==
<syntaxhighlight lang='console'>
root@wsl:~# go version /usr/local/bin/helm
/usr/local/bin/helm: go1.24.4
</syntaxhighlight>
<syntaxhighlight lang='console'>
root@wsl:~# go version /usr/local/bin/kubectl
/usr/local/bin/kubectl: go1.24.4
</syntaxhighlight>
==버전 표시 Go 코드==
<syntaxhighlight lang='go' run>
<syntaxhighlight lang='go' run>
package main
package main
19번째 줄: 32번째 줄:
func main() {
func main() {
fmt.Println(runtime.Version())
fmt.Println(runtime.Version())
fmt.Println(runtime.GOOS)
fmt.Println(runtime.GOARCH)
}
}
</syntaxhighlight>
</syntaxhighlight>
25번째 줄: 40번째 줄:
* [[go 명령어]]
* [[go 명령어]]
* [[Go 버전 목록]]
* [[Go 버전 목록]]
* [[go version -m]]


[[분류: Go]]
[[분류: Go]]

2025년 8월 13일 (수) 10:45 기준 최신판

1 개요[ | ]

Go 버전 확인
go version
  • Go 버전을 출력하는 go 명령어

2 현재 환경의 Go 버전 (기본)[ | ]

root@wsl:~# go version
go version go1.24.5 linux/amd64

3 바이너리의 Go 버전[ | ]

root@wsl:~# go version /usr/local/bin/helm
/usr/local/bin/helm: go1.24.4
root@wsl:~# go version /usr/local/bin/kubectl
/usr/local/bin/kubectl: go1.24.4

4 버전 표시 Go 코드[ | ]

package main

import (
	"fmt"
	"runtime"
)

func main() {
	fmt.Println(runtime.Version())
	fmt.Println(runtime.GOOS)
	fmt.Println(runtime.GOARCH)
}

5 같이 보기[ | ]

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