Home >Backend Development >Golang >How to check the go language version

How to check the go language version

青灯夜游
青灯夜游Original
2021-03-15 17:19:509441browse

How to check the go language version: first introduce the fmt and runtime packages, and then use the Println() and Version() methods to output the version number. The specific syntax format is "fmt.Println(runtime.Version() )".

How to check the go language version

The operating environment of this tutorial: windows10 system, GO 1.12.9, thinkpad t480 computer.

Since I am learning the go language, checking the version number is not as convenient as python. python can do it with one command python -V, but go is more troublesome. Please see the following

package main
import (
    "fmt"
    "runtime"
)
func main() {
    fmt.Println(runtime.Version())
}
 
// 输出结果
go1.12.9

Recommended learning:Golang tutorial

The above is the detailed content of How to check the go language version. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:Is go a dynamic language?Next article:Is go a dynamic language?