This repository was archived by the owner on Sep 9, 2020. It is now read-only.
  
  
  - 
                Notifications
    You must be signed in to change notification settings 
- Fork 1k
Update CI and add version command #996
          
     Merged
      
      
    
  
     Merged
                    Changes from all commits
      Commits
    
    
            Show all changes
          
          
            11 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      d04e58e
              
                Add version command
              
              
                ebati 33610e5
              
                Add deploy stage to CI
              
              
                ebati a189bb1
              
                Add windows binary
              
              
                ebati 61c0b05
              
                Update documentation
              
              
                ebati 399752e
              
                Add windows release
              
              
                ebati 9a15432
              
                Move various CI commands to bash files
              
              
                ebati 52f2cc9
              
                Update readme with de-emphasized go get
              
              
                ebati 2484c39
              
                Add brew formula with dryrun option
              
              
                ebati f4428b6
              
                Add brew update
              
              
                ebati ad93f48
              
                Replace variables for golang/dep
              
              
                ebati 9217125
              
                Fix wording
              
              
                ebati File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,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 | ||
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| #!/usr/bin/env bash | ||
| # Copyright 2017 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. | ||
| # | ||
| # This script will build dep and calculate hash for each | ||
| # (DEP_BUILD_PLATFORMS, DEP_BUILD_ARCHS) pair. | ||
| # DEP_BUILD_PLATFORMS="linux" DEP_BUILD_ARCHS="amd64" ./hack/build-all.sh | ||
| # can be called to build only for linux-amd64 | ||
|  | ||
| set -e | ||
|  | ||
| VERSION=$(git describe --tags --dirty) | ||
| COMMIT_HASH=$(git rev-parse --short HEAD 2>/dev/null) | ||
| DATE=$(date --iso-8601) | ||
|  | ||
| GO_BUILD_CMD="go build -a -installsuffix cgo" | ||
| GO_BUILD_LDFLAGS="-s -w -X main.commitHash=$COMMIT_HASH -X main.buildDate=$DATE -X main.version=$VERSION" | ||
|  | ||
| if [ -z "$DEP_BUILD_PLATFORMS" ]; then | ||
| DEP_BUILD_PLATFORMS="linux windows darwin" | ||
| fi | ||
|  | ||
| if [ -z "$DEP_BUILD_ARCHS" ]; then | ||
| DEP_BUILD_ARCHS="amd64" | ||
| fi | ||
|  | ||
| mkdir -p release | ||
|  | ||
| for OS in ${DEP_BUILD_PLATFORMS[@]}; do | ||
| for ARCH in ${DEP_BUILD_ARCHS[@]}; do | ||
| echo "Building for $OS/$ARCH" | ||
| GOARCH=$ARCH GOOS=$OS CGO_ENABLED=0 $GO_BUILD_CMD -ldflags "$GO_BUILD_LDFLAGS"\ | ||
| -o "release/dep-$OS-$ARCH" ./cmd/dep/ | ||
| sha256sum "release/dep-$OS-$ARCH" > "release/dep-$OS-$ARCH".sha256 | ||
| done | ||
| done | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| #!/usr/bin/env bash | ||
| # Copyright 2017 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. | ||
| # | ||
| # This script will generate coverage.txt | ||
| set -e | ||
|  | ||
| PKGS=$(go list ./... | grep -v /vendor/) | ||
| for pkg in $PKGS; do | ||
| go test -race -coverprofile=profile.out -covermode=atomic $pkg | ||
| if [[ -f profile.out ]]; then | ||
| cat profile.out >> coverage.txt | ||
| rm profile.out | ||
| fi | ||
| done | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| #!/usr/bin/env bash | ||
| # Copyright 2017 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. | ||
| # | ||
| # This script will validate code with various linters | ||
| set -e | ||
|  | ||
| PKGS=$(go list ./... | grep -v /vendor/) | ||
| go vet $PKGS | ||
| staticcheck $PKGS | ||
| gosimple $PKGS | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| #!/usr/bin/env bash | ||
| # Copyright 2017 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. | ||
| # | ||
| # This script will build licenseok and run it on all | ||
| # source files to check licence | ||
| set -e | ||
|  | ||
| go build ./hack/licenseok | ||
| find . -path ./vendor -prune -o -type f -name "*.go"\ | ||
| -printf '%P\n' | xargs ./licenseok | 
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure we want to remove the traditional way of getting Go tools from the README. 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will
go getbe the normal users installation method or it will be there as a note developers. If it is for normal use, I dont think it is a good idea to use tool from the tip of the master.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i don't think we can remove it, but we should de-emphasize it - put it after other recommended methods.