~james-page/ubuntu/trusty/gccgo-go/trunk

« back to all changes in this revision

Viewing changes to src/cmd/go/version.go

  • Committer: James Page
  • Date: 2014-01-22 11:10:56 UTC
  • Revision ID: james.page@canonical.com-20140122111056-hfyxm1ozm7if9t3f
Tags: upstream-1.2
ImportĀ upstreamĀ versionĀ 1.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
}