Merge pull request #62037 from cblecker/godep-bump

Automatic merge from submit-queue (batch tested with PRs 61959, 62037). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Bump godep version to v80

**What this PR does / why we need it**:
Update the minimum godep, to v80 (supposed to be the final version).

**Release note**:
```release-note
NONE
```
This commit is contained in:
Kubernetes Submit Queue 2018-04-04 02:45:08 -07:00 committed by GitHub
commit 22440e1576
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 69 additions and 134 deletions

6
Godeps/Godeps.json generated
View File

@ -1,7 +1,7 @@
{ {
"ImportPath": "k8s.io/kubernetes", "ImportPath": "k8s.io/kubernetes",
"GoVersion": "go1.9", "GoVersion": "go1.9",
"GodepVersion": "v79", "GodepVersion": "v80",
"Packages": [ "Packages": [
"github.com/onsi/ginkgo/ginkgo", "github.com/onsi/ginkgo/ginkgo",
"github.com/jteeuwen/go-bindata/go-bindata", "github.com/jteeuwen/go-bindata/go-bindata",
@ -2693,8 +2693,8 @@
}, },
{ {
"ImportPath": "github.com/tools/godep", "ImportPath": "github.com/tools/godep",
"Comment": "v79", "Comment": "v80",
"Rev": "f15f6db5da33a4ac48be83e20b9dd838e14f117b" "Rev": "ce0bfadeb516ab23c845a85c4b0eae421ec9614b"
}, },
{ {
"ImportPath": "github.com/ugorji/go/codec", "ImportPath": "github.com/ugorji/go/codec",

View File

@ -428,7 +428,7 @@ kube::util::ensure_clean_working_dir() {
# Ensure that the given godep version is installed and in the path. Almost # Ensure that the given godep version is installed and in the path. Almost
# nobody should use any version but the default. # nobody should use any version but the default.
kube::util::ensure_godep_version() { kube::util::ensure_godep_version() {
GODEP_VERSION=${1:-"v79"} # this version is known to work GODEP_VERSION=${1:-"v80"} # this version is known to work
if [[ "$(godep version 2>/dev/null)" == *"godep ${GODEP_VERSION}"* ]]; then if [[ "$(godep version 2>/dev/null)" == *"godep ${GODEP_VERSION}"* ]]; then
return return

View File

@ -1,7 +1,7 @@
{ {
"ImportPath": "k8s.io/api", "ImportPath": "k8s.io/api",
"GoVersion": "go1.9", "GoVersion": "go1.9",
"GodepVersion": "v79", "GodepVersion": "v80",
"Packages": [ "Packages": [
"./..." "./..."
], ],

View File

@ -1,7 +1,7 @@
{ {
"ImportPath": "k8s.io/apiextensions-apiserver", "ImportPath": "k8s.io/apiextensions-apiserver",
"GoVersion": "go1.9", "GoVersion": "go1.9",
"GodepVersion": "v79", "GodepVersion": "v80",
"Packages": [ "Packages": [
"./..." "./..."
], ],

View File

@ -1,7 +1,7 @@
{ {
"ImportPath": "k8s.io/apimachinery", "ImportPath": "k8s.io/apimachinery",
"GoVersion": "go1.9", "GoVersion": "go1.9",
"GodepVersion": "v79", "GodepVersion": "v80",
"Packages": [ "Packages": [
"./..." "./..."
], ],

View File

@ -1,7 +1,7 @@
{ {
"ImportPath": "k8s.io/apiserver", "ImportPath": "k8s.io/apiserver",
"GoVersion": "go1.9", "GoVersion": "go1.9",
"GodepVersion": "v79", "GodepVersion": "v80",
"Packages": [ "Packages": [
"./..." "./..."
], ],

View File

@ -1,7 +1,7 @@
{ {
"ImportPath": "k8s.io/client-go", "ImportPath": "k8s.io/client-go",
"GoVersion": "go1.9", "GoVersion": "go1.9",
"GodepVersion": "v79", "GodepVersion": "v80",
"Packages": [ "Packages": [
"./..." "./..."
], ],

View File

@ -1,7 +1,7 @@
{ {
"ImportPath": "k8s.io/code-generator", "ImportPath": "k8s.io/code-generator",
"GoVersion": "go1.9", "GoVersion": "go1.9",
"GodepVersion": "v79", "GodepVersion": "v80",
"Packages": [ "Packages": [
"./..." "./..."
], ],

View File

@ -1,7 +1,7 @@
{ {
"ImportPath": "k8s.io/kube-aggregator", "ImportPath": "k8s.io/kube-aggregator",
"GoVersion": "go1.9", "GoVersion": "go1.9",
"GodepVersion": "v79", "GodepVersion": "v80",
"Packages": [ "Packages": [
"./..." "./..."
], ],

View File

@ -1,7 +1,7 @@
{ {
"ImportPath": "k8s.io/metrics", "ImportPath": "k8s.io/metrics",
"GoVersion": "go1.9", "GoVersion": "go1.9",
"GodepVersion": "v79", "GodepVersion": "v80",
"Packages": [ "Packages": [
"./..." "./..."
], ],

View File

@ -1,7 +1,7 @@
{ {
"ImportPath": "k8s.io/sample-apiserver", "ImportPath": "k8s.io/sample-apiserver",
"GoVersion": "go1.9", "GoVersion": "go1.9",
"GodepVersion": "v79", "GodepVersion": "v80",
"Packages": [ "Packages": [
"./..." "./..."
], ],

View File

@ -1,7 +1,7 @@
{ {
"ImportPath": "k8s.io/sample-controller", "ImportPath": "k8s.io/sample-controller",
"GoVersion": "go1.9", "GoVersion": "go1.9",
"GodepVersion": "v79", "GodepVersion": "v80",
"Packages": [ "Packages": [
"./..." "./..."
], ],

View File

@ -1,3 +1,7 @@
#v80 (2018/01/26)
* Address lin/vet feedback.
#v79 (2017/02/01) #v79 (2017/02/01)
* Fixes #531: fullPackageInDir didn't capture the error from fillPackage() * Fixes #531: fullPackageInDir didn't capture the error from fillPackage()

View File

@ -1,4 +1,8 @@
## Godep # Godep - Archived
Please use [dep](https://github.com/golang/dep) or another tool instead.
The rest of this readme is preserved for those that may still need its contents.
[![Build Status](https://travis-ci.org/tools/godep.svg)](https://travis-ci.org/tools/godep) [![Build Status](https://travis-ci.org/tools/godep.svg)](https://travis-ci.org/tools/godep)
@ -6,16 +10,23 @@
godep helps build packages reproducibly by fixing their dependencies. godep helps build packages reproducibly by fixing their dependencies.
This tool assumes you are working in a standard Go workspace, as described in This tool assumes you are working in a standard Go workspace, as described [here](http://golang.org/doc/code.html). We
http://golang.org/doc/code.html. We expect godep to build on Go 1.4* or newer, expect godep to build on Go 1.4* or newer, but you can use it on any project that works with Go 1 or newer.
but you can use it on any project that works with Go 1 or newer.
Please check the [FAQ](FAQ.md) if you have a question. Please check the [FAQ](FAQ.md) if you have a question.
## Golang Dep
The Go community now has the [dep](https://github.com/golang/dep) project to
manage dependencies. Please consider trying to migrate from Godep to dep. If there
is an issue preventing you from migrating please file an issue with dep so the
problem can be corrected. Godep will continue to be supported for some time but
is considered to be in a state of support rather than active feature development.
## Install ## Install
```console ```console
$ go get github.com/tools/godep go get github.com/tools/godep
``` ```
## How to use godep with a new project ## How to use godep with a new project
@ -24,7 +35,7 @@ Assuming you've got everything working already, so you can build your project
with `go install` and test it with `go test`, it's one command to start using: with `go install` and test it with `go test`, it's one command to start using:
```console ```console
$ godep save godep save
``` ```
This will save a list of dependencies to the file `Godeps/Godeps.json` and copy This will save a list of dependencies to the file `Godeps/Godeps.json` and copy
@ -64,7 +75,6 @@ time** you run a Go-related command, you wrap it in one of these two ways:
`-r` isn't necessary with go1.6+ and isn't allowed. `-r` isn't necessary with go1.6+ and isn't allowed.
## Additional Operations ## Additional Operations
### Restore ### Restore
@ -75,6 +85,8 @@ modifies the state of packages in your `$GOPATH`. NOTE: `godep restore` leaves
git repositories in a detached state. `go1.6`+ no longer checks out the master git repositories in a detached state. `go1.6`+ no longer checks out the master
branch when doing a `go get`, see [here](https://github.com/golang/go/commit/42206598671a44111c8f726ad33dc7b265bdf669). branch when doing a `go get`, see [here](https://github.com/golang/go/commit/42206598671a44111c8f726ad33dc7b265bdf669).
> If you run `godep restore` in your main `$GOPATH` `go get -u` will fail on packages that are behind master.
Please see the [FAQ](https://github.com/tools/godep/blob/master/FAQ.md#should-i-use-godep-restore) section about restore. Please see the [FAQ](https://github.com/tools/godep/blob/master/FAQ.md#should-i-use-godep-restore) section about restore.
### Edit-test Cycle ### Edit-test Cycle
@ -96,11 +108,10 @@ To add a new package foo/bar, do this:
To update a package from your `$GOPATH`, do this: To update a package from your `$GOPATH`, do this:
1. Run `go get -u foo/bar` 1. Run `go get -u foo/bar`
1. Run `godep update foo/bar`. (You can use the `...` wildcard, for example 1. Run `godep update foo/bar`.
`godep update foo/...`).
Before comitting the change, you'll probably want to inspect the changes to You can use the `...` wildcard, for example `godep update foo/...`. Before comitting the change, you'll probably want to
Godeps, for example with `git diff`, and make sure it looks reasonable. inspect the changes to Godeps, for example with `git diff`, and make sure it looks reasonable.
## Multiple Packages ## Multiple Packages
@ -109,22 +120,21 @@ running commands like `go test ./...`, `go install ./...`, and `go fmt ./...`.
Similarly, you should run `godep save ./...` to capture the dependencies of all Similarly, you should run `godep save ./...` to capture the dependencies of all
packages in your application. packages in your application.
## File Format ## File Format
Godeps is a json file with the following structure: Godeps is a json file with the following structure:
```go ```go
type Godeps struct { type Godeps struct {
ImportPath string ImportPath string
GoVersion string // Abridged output of 'go version'. GoVersion string // Abridged output of 'go version'.
GodepVersion string // Abridged output of 'godep version' GodepVersion string // Abridged output of 'godep version'
Packages []string // Arguments to godep save, if any. Packages []string // Arguments to godep save, if any.
Deps []struct { Deps []struct {
ImportPath string ImportPath string
Comment string // Description of commit, if present. Comment string // Description of commit, if present.
Rev string // VCS-specific commit ID. Rev string // VCS-specific commit ID.
} }
} }
``` ```
@ -132,18 +142,18 @@ Example Godeps:
```json ```json
{ {
"ImportPath": "github.com/kr/hk", "ImportPath": "github.com/kr/hk",
"GoVersion": "go1.6", "GoVersion": "go1.6",
"Deps": [ "Deps": [
{ {
"ImportPath": "code.google.com/p/go-netrc/netrc", "ImportPath": "code.google.com/p/go-netrc/netrc",
"Rev": "28676070ab99" "Rev": "28676070ab99"
}, },
{ {
"ImportPath": "github.com/kr/binarydist", "ImportPath": "github.com/kr/binarydist",
"Rev": "3380ade90f8b0dfa3e363fd7d7e941fa857d0d13" "Rev": "3380ade90f8b0dfa3e363fd7d7e941fa857d0d13"
} }
] ]
} }
``` ```

View File

@ -25,10 +25,6 @@ type Godeps struct {
isOldFile bool isOldFile bool
} }
func createGodepsFile() (*os.File, error) {
return os.Create(godepsFile)
}
func loadGodepsFile(path string) (Godeps, error) { func loadGodepsFile(path string) (Godeps, error) {
var g Godeps var g Godeps
f, err := os.Open(path) f, err := os.Open(path)
@ -201,9 +197,7 @@ func (g *Godeps) addOrUpdateDeps(deps []Dependency) {
missing = append(missing, d) missing = append(missing, d)
} }
} }
for _, d := range missing { g.Deps = append(g.Deps, missing...)
g.Deps = append(g.Deps, d)
}
} }
func (g *Godeps) removeDeps(deps []Dependency) { func (g *Godeps) removeDeps(deps []Dependency) {

View File

@ -51,7 +51,7 @@ func IsLegalFile(filename string) bool {
} }
} }
for _, substring := range LegalFileSubstring { for _, substring := range LegalFileSubstring {
if strings.Index(lowerfile, substring) != -1 { if strings.Contains(lowerfile, substring) {
return true return true
} }
} }

View File

@ -54,10 +54,7 @@ func (ds *depScanner) Next() (*build.Package, string) {
// Continue looping? // Continue looping?
func (ds *depScanner) Continue() bool { func (ds *depScanner) Continue() bool {
if len(ds.todo) > 0 { return len(ds.todo) > 0
return true
}
return false
} }
// Add a package and imports to the depScanner. Skips already processed/pending package/import combos // Add a package and imports to the depScanner. Skips already processed/pending package/import combos
@ -94,7 +91,7 @@ func fullPackageInDir(dir string) (*build.Package, error) {
var err error var err error
pkg, ok := pkgCache[dir] pkg, ok := pkgCache[dir]
if !ok { if !ok {
pkg, err = build.ImportDir(dir, build.FindOnly) pkg, _ = build.ImportDir(dir, build.FindOnly)
if pkg.Goroot { if pkg.Goroot {
pkg, err = build.ImportDir(pkg.Dir, 0) pkg, err = build.ImportDir(pkg.Dir, 0)
} else { } else {

20
vendor/github.com/tools/godep/msg.go generated vendored
View File

@ -27,29 +27,9 @@ func debugf(format string, a ...interface{}) (int, error) {
return 0, nil return 0, nil
} }
func verbosef(format string, a ...interface{}) {
if verbose {
log.Printf(format, a...)
}
}
func pp(a ...interface{}) (int, error) {
if debug {
return pretty.Print(a...)
}
return 0, nil
}
func ppln(a ...interface{}) (int, error) { func ppln(a ...interface{}) (int, error) {
if debug { if debug {
return pretty.Println(a...) return pretty.Println(a...)
} }
return 0, nil return 0, nil
} }
func ppf(format string, a ...interface{}) (int, error) {
if debug {
return pretty.Printf(format, a...)
}
return 0, nil
}

View File

@ -98,6 +98,9 @@ func rewriteGoFile(name, qual string, paths []string) error {
} }
fset = token.NewFileSet() fset = token.NewFileSet()
f, err = parser.ParseFile(fset, name, &buffer, parser.ParseComments) f, err = parser.ParseFile(fset, name, &buffer, parser.ParseComments)
if err != nil {
return err
}
ast.SortImports(fset, f) ast.SortImports(fset, f)
tpath := name + ".temp" tpath := name + ".temp"
t, err := os.Create(tpath) t, err := os.Create(tpath)

View File

@ -1,35 +1,11 @@
package main package main
import ( import (
"fmt"
"os/exec"
"path/filepath" "path/filepath"
"runtime" "runtime"
"strings" "strings"
) )
// Runs a command in dir.
// The name and args are as in exec.Command.
// Stdout, stderr, and the environment are inherited
// from the current process.
func runIn(dir, name string, args ...string) error {
_, err := runInWithOutput(dir, name, args...)
return err
}
func runInWithOutput(dir, name string, args ...string) (string, error) {
c := exec.Command(name, args...)
c.Dir = dir
o, err := c.CombinedOutput()
if debug {
fmt.Printf("execute: %+v\n", c)
fmt.Printf(" output: %s\n", string(o))
}
return string(o), err
}
// driveLetterToUpper converts Windows path's drive letters to uppercase. This // driveLetterToUpper converts Windows path's drive letters to uppercase. This
// is needed when comparing 2 paths with different drive letter case. // is needed when comparing 2 paths with different drive letter case.
func driveLetterToUpper(path string) string { func driveLetterToUpper(path string) string {

29
vendor/github.com/tools/godep/vcs.go generated vendored
View File

@ -79,19 +79,6 @@ func VCSFromDir(dir, srcRoot string) (*VCS, string, error) {
return vcsext, reporoot, nil return vcsext, reporoot, nil
} }
// VCSForImportPath returns a VCS value for an import path.
func VCSForImportPath(importPath string) (*VCS, error) {
rr, err := vcs.RepoRootForImportPath(importPath, debug)
if err != nil {
return nil, err
}
vcs := cmd[rr.VCS]
if vcs == nil {
return nil, fmt.Errorf("%s is unsupported: %s", rr.VCS.Name, importPath)
}
return vcs, nil
}
func (v *VCS) identify(dir string) (string, error) { func (v *VCS) identify(dir string) (string, error) {
out, err := v.runOutput(dir, v.IdentifyCmd) out, err := v.runOutput(dir, v.IdentifyCmd)
return string(bytes.TrimSpace(out)), err return string(bytes.TrimSpace(out)), err
@ -260,22 +247,6 @@ func expand(m map[string]string, s string) string {
return s return s
} }
// Mercurial has no command equivalent to git remote add.
// We handle it as a special case in process.
func hgLink(dir, remote, url string) error {
hgdir := filepath.Join(dir, ".hg")
if err := os.MkdirAll(hgdir, 0777); err != nil {
return err
}
path := filepath.Join(hgdir, "hgrc")
f, err := os.OpenFile(path, os.O_WRONLY|os.O_APPEND|os.O_CREATE, 0666)
if err != nil {
return err
}
fmt.Fprintf(f, "[paths]\n%s = %s\n", remote, url)
return f.Close()
}
func gitDetached(r string) (bool, error) { func gitDetached(r string) (bool, error) {
o, err := vcsGit.runOutput(r, "status") o, err := vcsGit.runOutput(r, "status")
if err != nil { if err != nil {

View File

@ -8,7 +8,7 @@ import (
"strings" "strings"
) )
const version = 79 const version = 80
var cmdVersion = &Command{ var cmdVersion = &Command{
Name: "version", Name: "version",