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

How to check the go language version

青灯夜游
Release: 2023-01-13 00:21:56
Original
9442 people have browsed it

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
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template