github.com/bgentry/go@v0.0.0-20150121062915-6cf5a733d54d/src/cmd/go/version.go (about) 1 // Copyright 2011 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package main 6 7 import ( 8 "fmt" 9 "runtime" 10 ) 11 12 var cmdVersion = &Command{ 13 Run: runVersion, 14 UsageLine: "version", 15 Short: "print Go version", 16 Long: `Version prints the Go version, as reported by runtime.Version.`, 17 } 18 19 func runVersion(cmd *Command, args []string) { 20 if len(args) != 0 { 21 cmd.Usage() 22 } 23 24 fmt.Printf("go version %s %s/%s\n", runtime.Version(), runtime.GOOS, runtime.GOARCH) 25 }