forked from golang/dep
-
Notifications
You must be signed in to change notification settings - Fork 0
/
version.go
45 lines (36 loc) · 1.06 KB
/
version.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Copyright 2016 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import (
"flag"
"runtime"
"github.com/golang/dep"
)
var (
version = "devel"
buildDate string
commitHash string
)
const versionHelp = `Show the dep version information`
func (cmd *versionCommand) Name() string { return "version" }
func (cmd *versionCommand) Args() string {
return ""
}
func (cmd *versionCommand) ShortHelp() string { return versionHelp }
func (cmd *versionCommand) LongHelp() string { return versionHelp }
func (cmd *versionCommand) Hidden() bool { return false }
func (cmd *versionCommand) Register(fs *flag.FlagSet) {}
type versionCommand struct{}
func (cmd *versionCommand) Run(ctx *dep.Ctx, args []string) error {
ctx.Out.Printf(`dep:
version : %s
build date : %s
git hash : %s
go version : %s
go compiler : %s
platform : %s/%s
`, version, buildDate, commitHash,
runtime.Version(), runtime.Compiler, runtime.GOOS, runtime.GOARCH)
return nil
}