1// Copyright 2016 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 5package main 6 7import ( 8 "flag" 9 "runtime" 10 11 "github.com/golang/dep" 12) 13 14var ( 15 version = "devel" 16 buildDate string 17 commitHash string 18) 19 20const versionHelp = `Show the dep version information` 21 22func (cmd *versionCommand) Name() string { return "version" } 23func (cmd *versionCommand) Args() string { 24 return "" 25} 26func (cmd *versionCommand) ShortHelp() string { return versionHelp } 27func (cmd *versionCommand) LongHelp() string { return versionHelp } 28func (cmd *versionCommand) Hidden() bool { return false } 29 30func (cmd *versionCommand) Register(fs *flag.FlagSet) {} 31 32type versionCommand struct{} 33 34func (cmd *versionCommand) Run(ctx *dep.Ctx, args []string) error { 35 ctx.Out.Printf(`dep: 36 version : %s 37 build date : %s 38 git hash : %s 39 go version : %s 40 go compiler : %s 41 platform : %s/%s 42 features : ImportDuringSolve=%v 43`, version, buildDate, commitHash, 44 runtime.Version(), runtime.Compiler, runtime.GOOS, runtime.GOARCH, 45 importDuringSolve()) 46 return nil 47} 48