github.com/golang/dep@v0.5.4/cmd/dep/version.go (about)

     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  
     5  package main
     6  
     7  import (
     8  	"flag"
     9  	"runtime"
    10  
    11  	"github.com/golang/dep"
    12  )
    13  
    14  var (
    15  	version    = "devel"
    16  	buildDate  string
    17  	commitHash string
    18  )
    19  
    20  const versionHelp = `Show the dep version information`
    21  
    22  func (cmd *versionCommand) Name() string { return "version" }
    23  func (cmd *versionCommand) Args() string {
    24  	return ""
    25  }
    26  func (cmd *versionCommand) ShortHelp() string { return versionHelp }
    27  func (cmd *versionCommand) LongHelp() string  { return versionHelp }
    28  func (cmd *versionCommand) Hidden() bool      { return false }
    29  
    30  func (cmd *versionCommand) Register(fs *flag.FlagSet) {}
    31  
    32  type versionCommand struct{}
    33  
    34  func (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  }