diff options
| author | Shulhan <ms@kilabit.info> | 2018-06-02 05:41:39 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2018-06-04 00:07:21 +0700 |
| commit | fd2b25bb08063ed7deb09757374a260dba22ee5a (patch) | |
| tree | 01c3ae4ddbbb67a50067913bcc3eaf7821845c64 | |
| parent | 8c316a9b4cea498dfaecf41b00b6c1df239b14cb (diff) | |
| download | beku-fd2b25bb08063ed7deb09757374a260dba22ee5a.tar.xz | |
Add common option "-V, --vendor" to work with vendor directory
| -rw-r--r-- | README.md | 51 | ||||
| -rw-r--r-- | beku.go | 5 | ||||
| -rw-r--r-- | beku_test.go | 8 | ||||
| -rw-r--r-- | cmd/beku/command.go | 17 | ||||
| -rw-r--r-- | cmd/beku/main.go | 50 | ||||
| -rw-r--r-- | env.go | 128 | ||||
| -rw-r--r-- | package.go | 23 | ||||
| -rw-r--r-- | package_git.go | 4 | ||||
| -rw-r--r-- | package_test.go | 4 | ||||
| -rw-r--r-- | testdata/beku.db | 1 |
10 files changed, 185 insertions, 106 deletions
@@ -1,6 +1,7 @@ # Beku -Beku is a library and program to manage packages in `$GOPATH`. +Beku is a library and program to manage packages in user's environment (GOPATH +or vendor directory). For beku as library see the following [](https://godoc.org/github.com/shuLhan/beku). @@ -11,16 +12,16 @@ For beku as program see the below documentation or at # Beku program -Beku is command line program to manage packages in $GOPATH. Beku provide -syntax like `pacman`. +Beku is command line program to manage packages in user's environment (GOPATH +or vendor directory). Beku provide syntax like `pacman`. Beku read and write the package database into a file named "beku.db". At first execution, beku will try to open the package database in current directory. If no file found, it will try to open -"$GOPATH/var/beku/beku.db". When both locations does not provide -package database, beku will scan entire "$GOPATH/src" and write the -package database into "$GOPATH/var/beku/beku.db". +"{prefix}/var/beku/beku.db". When both locations does not provide +package database, beku will scan entire "{prefix}/src" and write the +package database into "{prefix}/var/beku/beku.db". ## Global Options @@ -29,15 +30,21 @@ package database into "$GOPATH/var/beku/beku.db". No confirmation will be asked on any operation. Useful when running beku inside a script. + -V, --vendor + +Operate in vendor mode. This option used only when first scanning +(`beku -V -S`). +Any operation after that, will use the "vendor" directory in current +working directory as installation prefix. ## Freeze Operation -B, --freeze -Operate on the package database and GOPATH. This operation will ensure that -all packages listed on database file is installed with their specific -version on GOPATH. Also, all packages that are not registered will be -removed from GOPATH "src" and "pkg" directories. +Operate on the package database and user's environment. This operation will +ensure that all packages listed on database file is installed with their +specific version. Also, all packages that are not registered will +be removed from "src" and "pkg" directories. ## Database Operation @@ -72,7 +79,7 @@ Query the package database. -R, --remove [pkg] -Remove package from GOPATH, including source and installed binaries and +Remove package from environment, including source and installed binaries and archives. ### Options @@ -86,16 +93,16 @@ packages. $ beku -R github.com/shuLhan/beku -Remove package "github.com/shuLhan/beku" source in "$GOPATH/src", -their installed binaries in "$GOPATH/bin", and their installed archives on -"$GOPATH/pkg/{GOOS}_{GOARCH}". +Remove package "github.com/shuLhan/beku" source in "{prefix}/src", +their installed binaries in "{prefix}/bin", and their installed archives on +"{prefix}/pkg/{GOOS}_{GOARCH}". $ beku -R github.com/shuLhan/beku --recursive $ beku -Rs github.com/shuLhan/beku -Remove package "github.com/shuLhan/beku" source in "$GOPATH/src", -their installed binaries in "$GOPATH/bin", their installed archives on -"$GOPATH/pkg/{GOOS}_{GOARCH}", and all their dependencies. +Remove package "github.com/shuLhan/beku" source in "{prefix}/src", +their installed binaries in "{prefix}/bin", their installed archives on +"{prefix}/pkg/{GOOS}_{GOARCH}", and all their dependencies. ## Sync Operation @@ -103,7 +110,7 @@ their installed binaries in "$GOPATH/bin", their installed archives on -S, --sync <pkg[@version]> Synchronizes package. Given a package import path, beku will try to clone -the package into GOPATH source directory and set the package version to +the package into source directory and set the package version to latest the tag. If no tag found, it will use the latest commit on master branch. A specific version can be set using "@version" suffix. @@ -129,23 +136,23 @@ confirmation before upgrade. $ beku -S golang.org/x/text -Download package `golang.org/x/text` into `$GOPATH/src/golang.org/x/text`, +Download package `golang.org/x/text` into `{prefix}/src/golang.org/x/text`, and set their version to the latest commit on branch master. $ beku -S github.com/golang/text --into golang.org/x/text Download package `github.com/golang/text` into -`$GOPATH/src/golang.org/x/text`, and set their version to the latest commit +`{prefix}/src/golang.org/x/text`, and set their version to the latest commit on branch master. $ beku -S golang.org/x/text@v0.3.0 -Download package `golang.org/x/text` into `$GOPATH/src/golang.org/x/text` +Download package `golang.org/x/text` into `{prefix}/src/golang.org/x/text` and checkout the tag `v0.3.0` as the working version. $ beku -S golang.org/x/text@5c1cf69 -Download package `golang.org/x/text` into `$GOPATH/src/golang.org/x/text` +Download package `golang.org/x/text` into `{prefix}/src/golang.org/x/text` and checkout the commit `5c1cf69` as the working version. $ beku -Su @@ -38,7 +38,6 @@ const ( // List of error messages. var ( - ErrGOPATH = errors.New("GOPATH is not defined") ErrGOROOT = errors.New("GOROOT is not defined") // ErrVersion define an error when directory have VCS metadata (e.g. @@ -71,9 +70,11 @@ var ( sectionBeku = "beku" sectionPackage = "package" + keyExclude = "exclude" + keyVendor = "vendor" + keyDeps = "deps" keyDepsMissing = "missing" - keyExclude = "exclude" keyRemoteName = "remote-name" keyRemoteURL = "remote-url" keyRequiredBy = "required-by" diff --git a/beku_test.go b/beku_test.go index f258e43..0754df9 100644 --- a/beku_test.go +++ b/beku_test.go @@ -106,15 +106,15 @@ func TestMain(m *testing.M) { os.Exit(1) } - testEnv, err = NewEnvironment() + testEnv, err = NewEnvironment(false) if err != nil { fmt.Fprintln(os.Stderr, err) os.Exit(1) } - testGitPkgCur, _ = NewPackage(testGitRepo, testGitRepo) - testGitPkgNew, _ = NewPackage(testGitRepo, testGitRepo) - testGitPkgShare, _ = NewPackage(testGitRepoShare, testGitRepoShare) + testGitPkgCur, _ = NewPackage(testEnv, testGitRepo, testGitRepo) + testGitPkgNew, _ = NewPackage(testEnv, testGitRepo, testGitRepo) + testGitPkgShare, _ = NewPackage(testEnv, testGitRepoShare, testGitRepoShare) // Always set the git test repo to latest version. testEnv.NoConfirm = true diff --git a/cmd/beku/command.go b/cmd/beku/command.go index 8383016..f3ed445 100644 --- a/cmd/beku/command.go +++ b/cmd/beku/command.go @@ -28,6 +28,7 @@ const ( flagOptionRecursive = "Remove package including their dependencies." flagOptionSyncInto = "Download package into `directory`." flagOptionUpdate = "Update all packages to latest version." + flagOptionVendor = "Operate in vendor mode." ) type command struct { @@ -37,6 +38,7 @@ type command struct { syncInto string firstTime bool noConfirm bool + vendor bool } func (cmd *command) usage() { @@ -44,6 +46,8 @@ func (cmd *command) usage() { common options: --noconfirm ` + flagOptionNoConfirm + ` + -V,--vendor + ` + flagOptionVendor + ` operations: beku {-h|--help} ` + flagOperationHelp + ` @@ -170,6 +174,11 @@ func (cmd *command) parseShortFlags(arg string) (operation, error) { return opNone, err } op |= opRemove + case 'V': + if len(arg) > 1 { + return opNone, errInvalidOptions + } + cmd.vendor = true default: return opNone, errInvalidOptions } @@ -206,6 +215,8 @@ func (cmd *command) parseLongFlags(arg string) (op operation, err error) { op = opSync case "update": op = opUpdate + case "vendor": + cmd.vendor = true default: return opNone, errInvalidOptions } @@ -302,7 +313,9 @@ func (cmd *command) loadDatabase() (err error) { return } - err = cmd.env.Load("") + if !cmd.vendor { + err = cmd.env.Load("") + } return } @@ -347,7 +360,7 @@ func newCommand() (cmd *command, err error) { return } - cmd.env, err = beku.NewEnvironment() + cmd.env, err = beku.NewEnvironment(cmd.vendor) if err != nil { return } diff --git a/cmd/beku/main.go b/cmd/beku/main.go index 64fa1d5..8b1bc5d 100644 --- a/cmd/beku/main.go +++ b/cmd/beku/main.go @@ -3,16 +3,16 @@ // license that can be found in the LICENSE file. // -// Beku is a command line program to manage packages in $GOPATH. Beku provide -// syntax like `pacman`. +// Beku is a command line program to manage packages in user's environment +// (GOPATH or vendor) directory. Beku provide syntax like `pacman`. // // Beku read and write the package database into a file named "beku.db". // // At first execution, beku will try to open the package database in current // directory. If no file found, it will try to open -// "$GOPATH/var/beku/beku.db". When both locations does not provide -// package database, beku will scan entire "$GOPATH/src" and write the -// package database into "$GOPATH/var/beku/beku.db". +// "{prefix}/var/beku/beku.db". When both locations does not provide +// package database, beku will scan entire "{prefix}/src" and write the +// package database into "{prefix}/var/beku/beku.db". // // ## Global Options // @@ -21,15 +21,21 @@ // No confirmation will be asked on any operation. Useful when running beku // inside a script. // +// -V, --vendor +// +// Operate in vendor mode. This option used only when first scanning +// (`beku -V -S`). +// Any operation after that, will use the "vendor" directory in current +// working directory as installation prefix. // // ## Freeze Operation // // -B, --freeze // -// Operate on the package database and GOPATH. This operation will ensure that -// all packages listed on database file is installed with their specific -// version on GOPATH. Also, all packages that are not registered will be -// removed from GOPATH "src" and "pkg" directories. +// Operate on the package database and user's environment. This operation will +// ensure that all packages listed on database file is installed with their +// specific version. Also, all packages that are not registered +// will be removed from "src" and "pkg" directories. // // ## Database Operation // @@ -63,8 +69,8 @@ // // -R, --remove <pkg> // -// Remove package from GOPATH, including source and installed binaries and -// archives. +// Remove package from environment, including source and installed binaries +// and archives. // // ### Options // @@ -77,16 +83,16 @@ // // $ beku -R github.com/shuLhan/beku // -// Remove package "github.com/shuLhan/beku" source in "$GOPATH/src", -// their installed binaries in "$GOPATH/bin", and their installed archives on -// "$GOPATH/pkg/{GOOS}_{GOARCH}". +// Remove package "github.com/shuLhan/beku" source in "{prefix}/src", +// their installed binaries in "{prefix}/bin", and their installed archives on +// "{prefix}/pkg/{GOOS}_{GOARCH}". // // $ beku -R github.com/shuLhan/beku --recursive // $ beku -Rs github.com/shuLhan/beku // -// Remove package "github.com/shuLhan/beku" source in "$GOPATH/src", -// their installed binaries in "$GOPATH/bin", their installed archives on -// "$GOPATH/pkg/{GOOS}_{GOARCH}", and all their dependencies. +// Remove package "github.com/shuLhan/beku" source in "{prefix}/src", +// their installed binaries in "{prefix}/bin", their installed archives on +// "{prefix}/pkg/{GOOS}_{GOARCH}", and all their dependencies. // // // ## Sync Operation @@ -94,7 +100,7 @@ // -S, --sync <pkg[@version]> // // Synchronizes package. Given a package import path, beku will try to clone -// the package into GOPATH source directory and set the package version to +// the package into source directory and set the package version to // latest the tag. If no tag found, it will use the latest commit on master // branch. A specific version can be set using "@version" suffix. // @@ -120,23 +126,23 @@ // // $ beku -S golang.org/x/text // -// Download package `golang.org/x/text` into `$GOPATH/src/golang.org/x/text`, +// Download package `golang.org/x/text` into `{prefix}/src/golang.org/x/text`, // and set their version to the latest commit on branch master. // // $ beku -S github.com/golang/text --into golang.org/x/text // // Download package `github.com/golang/text` into -// `$GOPATH/src/golang.org/x/text`, and set their version to the latest commit +// `{prefix}/src/golang.org/x/text`, and set their version to the latest commit // on branch master. // // $ beku -S golang.org/x/text@v0.3.0 // -// Download package `golang.org/x/text` into `$GOPATH/src/golang.org/x/text` +// Download package `golang.org/x/text` into `{prefix}/src/golang.org/x/text` // and checkout the tag `v0.3.0` as the working version. // // $ beku -S golang.org/x/text@5c1cf69 // -// Download package `golang.org/x/text` into `$GOPATH/src/golang.org/x/text` +// Download package `golang.org/x/text` into `{prefix}/src/golang.org/x/text` // and checkout the commit `5c1cf69` as the working version. // // $ beku -Su @@ -3,7 +3,8 @@ // license that can be found in the LICENSE file. // -// Package beku provide library for managing Go packages in GOPATH. +// Package beku provide library for managing Go packages in user's environment +// (GOPATH or vendor directory). // package beku @@ -22,36 +23,39 @@ import ( // // Env contains the environment of Go including GOROOT source directory, -// GOPATH source directory, list of packages in GOPATH, list of standard +// package root directory (prefix), list of packages, list of standard // packages, and list of missing packages. // type Env struct { - dirBin string - dirPkg string - dirRootSrc string - dirSrc string - pkgs []*Package - pkgsExclude []string - pkgsMissing []string - pkgsStd []string - pkgsUnused []*Package - db *ini.Ini - dbDefFile string - dbFile string - countNew int - countUpdate int - fmtMaxPath int - dirty bool - NoConfirm bool + prefix string + dirBin string + dirPkg string + dirGoRootSrc string + dirSrc string + pkgs []*Package + pkgsExclude []string + pkgsMissing []string + pkgsStd []string + pkgsUnused []*Package + db *ini.Ini + dbDefFile string + dbFile string + countNew int + countUpdate int + fmtMaxPath int + dirty bool + NoConfirm bool + vendor bool } // // NewEnvironment will gather all information in user system. -// `beku` required that `$GOPATH` environment variable must exist. // -func NewEnvironment() (env *Env, err error) { - if len(build.Default.GOPATH) == 0 { - return nil, ErrGOPATH +func NewEnvironment(vendor bool) (env *Env, err error) { + if !vendor { + if len(build.Default.GOPATH) == 0 { + vendor = true + } } if len(build.Default.GOROOT) == 0 { return nil, ErrGOROOT @@ -61,19 +65,45 @@ func NewEnvironment() (env *Env, err error) { Debug = debugMode(debug) env = &Env{ - dirSrc: filepath.Join(build.Default.GOPATH, dirSrc), - dirRootSrc: filepath.Join(build.Default.GOROOT, dirSrc), - dirBin: filepath.Join(build.Default.GOPATH, dirBin), + dirGoRootSrc: filepath.Join(build.Default.GOROOT, dirSrc), + dirBin: filepath.Join(build.Default.GOPATH, dirBin), dirPkg: filepath.Join(build.Default.GOPATH, dirPkg, build.Default.GOOS+"_"+build.Default.GOARCH), - dbDefFile: filepath.Join(build.Default.GOPATH, dirDB, DefDBName), + vendor: vendor, + } + + if vendor { + err = env.initVendor() + if err != nil { + return + } + } else { + env.initGopath() } - err = env.scanStdPackages(env.dirRootSrc) + err = env.scanStdPackages(env.dirGoRootSrc) + + return +} + +func (env *Env) initGopath() { + env.prefix = build.Default.GOPATH + env.dirSrc = filepath.Join(build.Default.GOPATH, dirSrc) + env.dbDefFile = filepath.Join(build.Default.GOPATH, dirDB, DefDBName) +} + +func (env *Env) initVendor() (err error) { + wd, err := os.Getwd() if err != nil { return } + prefix := strings.TrimPrefix(wd, filepath.Join(build.Default.GOPATH, dirSrc)+"/") + + env.prefix = filepath.Join(prefix, dirVendor) + env.dirSrc = filepath.Join(wd, dirVendor) + env.dbDefFile = DefDBName + return } @@ -134,8 +164,8 @@ func (env *Env) Exclude(importPaths []string) { } // -// Freeze all packages in GOPATH. Install all registered packages in database -// and remove non-registered from GOPATH "src" and "pkg" directories. +// Freeze all packages in database. Install all registered packages in +// database and remove non-registered from "src" and "pkg" directories. // func (env *Env) Freeze() (err error) { var ( @@ -223,7 +253,7 @@ func (env *Env) GetPackage(importPath string) (pkg *Package, err error) { return } - pkg, err = NewPackage(importPath, importPath) + pkg, err = NewPackage(env, importPath, importPath) if err != nil { return } @@ -251,8 +281,8 @@ func (env *Env) GetPackageFromDB(importPath, remoteURL string) (int, *Package) { } // -// GetUnused will get all non-registered packages from GOPATH "src", without -// including all excluded packages. +// GetUnused will get all non-registered packages from "src" directory, +// without including all excluded packages. // func (env *Env) GetUnused(srcPath string) (err error) { fis, err := ioutil.ReadDir(srcPath) @@ -297,7 +327,7 @@ func (env *Env) GetUnused(srcPath string) (err error) { continue } - pkg, err = NewPackage(importPath, importPath) + pkg, err = NewPackage(env, importPath, importPath) if err != nil { return } @@ -379,7 +409,7 @@ func (env *Env) scanStdPackages(srcPath string) error { continue } - stdPkg := strings.TrimPrefix(fullPath, env.dirRootSrc+"/") + stdPkg := strings.TrimPrefix(fullPath, env.dirGoRootSrc+"/") env.pkgsStd = append(env.pkgsStd, stdPkg) } @@ -387,7 +417,7 @@ func (env *Env) scanStdPackages(srcPath string) error { } // -// scanPackages will traverse each directory in GOPATH `src` recursively until +// scanPackages will traverse each directory in `src` recursively until // it's found VCS metadata, e.g. `.git` directory. // // (0) skip file @@ -461,7 +491,7 @@ func (env *Env) newPackage(fullPath string) (err error) { return } - pkg, err := NewPackage(pkgName, pkgName) + pkg, err := NewPackage(env, pkgName, pkgName) if err != nil { return } @@ -556,6 +586,12 @@ func (env *Env) loadBeku() { } for _, v := range secBeku.Vars { + if v.KeyLower == keyVendor { + if v.IsValueBoolTrue() { + env.vendor = true + _ = env.initVendor() + } + } if v.KeyLower == keyExclude { env.addExclude(v.Value) } @@ -613,7 +649,7 @@ func (env *Env) Query(pkgs []string) { } // -// Rescan GOPATH for new packages. +// Rescan for new packages. // func (env *Env) Rescan(firstTime bool) (ok bool, err error) { err = env.Scan() @@ -694,8 +730,8 @@ func (env *Env) Rescan(firstTime bool) (ok bool, err error) { } // -// Remove package from GOPATH. If recursive is true, it will also remove their -// dependencies, as long as they are not required by other package. +// Remove package from environment. If recursive is true, it will also remove +// their dependencies, as long as they are not required by other package. // func (env *Env) Remove(rmPkg string, recursive bool) (err error) { if env.IsExcluded(rmPkg) { @@ -902,6 +938,12 @@ func (env *Env) Save(file string) (err error) { func (env *Env) saveBeku() { secBeku := ini.NewSection(sectionBeku, "") + if env.vendor { + secBeku.Set(keyVendor, "true") + } else { + secBeku.Set(keyVendor, "false") + } + for _, exclude := range env.pkgsExclude { secBeku.Add(keyExclude, exclude) } @@ -943,12 +985,14 @@ func (env *Env) String() string { fmt.Fprintf(&buf, ` [ENV] + Vendor: %t + Prefix: %s Dir bin: %s Dir pkg: %s Dir src: %s Dir root src: %s Standard Packages: %s -`, env.dirBin, env.dirPkg, env.dirSrc, env.dirRootSrc, env.pkgsStd) +`, env.vendor, env.prefix, env.dirBin, env.dirPkg, env.dirSrc, env.dirGoRootSrc, env.pkgsStd) for x := 0; x < len(env.pkgs); x++ { fmt.Fprintf(&buf, "%s", env.pkgs[x].String()) @@ -1137,7 +1181,7 @@ func (env *Env) Sync(pkgName, importPath string) (err error) { return } - newPkg, err := NewPackage(pkgName, importPath) + newPkg, err := NewPackage(env, pkgName, importPath) if err != nil { return } @@ -46,7 +46,7 @@ type Package struct { // NewPackage create a package set the package version, tag status, and // dependencies. // -func NewPackage(pkgName, importPath string) ( +func NewPackage(env *Env, pkgName, importPath string) ( pkg *Package, err error, ) { repoRoot, err := vcs.RepoRootForImportPath(pkgName, Debug >= DebugL2) @@ -67,8 +67,8 @@ func NewPackage(pkgName, importPath string) ( pkg = &Package{ ImportPath: repoRoot.Root, - FullPath: filepath.Join(build.Default.GOPATH, dirSrc, repoRoot.Root), - ScanPath: filepath.Join(build.Default.GOPATH, dirSrc, importPath), + FullPath: filepath.Join(env.dirSrc, repoRoot.Root), + ScanPath: filepath.Join(env.dirSrc, importPath), RemoteName: gitDefRemoteName, RemoteURL: repoRoot.Repo, vcsMode: repoRoot.VCS.Cmd, @@ -147,7 +147,7 @@ func (pkg *Package) GoClean() (err error) { } // -// Install a package. Clone package to GOPATH/src, set to the latest tag if +// Install a package. Clone package "src" directory, set to the latest tag if // exist or to the latest commit, and scan dependencies. // func (pkg *Package) Install() (err error) { @@ -189,7 +189,7 @@ func (pkg *Package) IsEqual(other *Package) bool { } // -// Remove package installed binaries, archives, and source from GOPATH. +// Remove package installed binaries, archives, and source. // func (pkg *Package) Remove() (err error) { err = pkg.GoClean() @@ -263,7 +263,7 @@ func (pkg *Package) ScanDeps(env *Env) (err error) { fmt.Println("[PKG] ScanDeps", pkg.ImportPath) } - imports, err := pkg.GetRecursiveImports() + imports, err := pkg.GetRecursiveImports(env) if err != nil { return } @@ -279,7 +279,7 @@ func (pkg *Package) ScanDeps(env *Env) (err error) { // GetRecursiveImports will get all import path recursively using `go list` // and return it as slice of string without any duplication. // -func (pkg *Package) GetRecursiveImports() ( +func (pkg *Package) GetRecursiveImports(env *Env) ( imports []string, err error, ) { //nolint:gas @@ -306,6 +306,10 @@ func (pkg *Package) GetRecursiveImports() ( importsDup := strings.Split(string(out), "\n") for x := 0; x < len(importsDup); x++ { + if env.vendor { + importsDup[x] = strings.TrimPrefix(importsDup[x], env.prefix+"/") + } + found = false for y := 0; y < len(imports); y++ { if importsDup[x] == imports[y] { @@ -334,7 +338,7 @@ func (pkg *Package) GetRecursiveImports() ( // (4) not standard packages // // (5) If all above filter passed, then it will do package normalization to -// check their dependencies with existing package in `$GOPATH/src`. +// check their dependencies with existing package in environment. // // (5.1) if match found, link the package deps to existing package instance. // (5.2) If no match found, add to list of missing `depsMissing` @@ -437,6 +441,9 @@ func (pkg *Package) load(sec *ini.Section) { // // GoInstall a package recursively ("./..."). // +// (1) Set PATH to let go install that require gcc work when invoked from +// non-interactive shell (e.g. buildbot). +// func (pkg *Package) GoInstall() (err error) { //nolint:gas cmd := exec.Command("go", "install") diff --git a/package_git.go b/package_git.go index 1f6d52d..ba50235 100644 --- a/package_git.go +++ b/package_git.go @@ -57,7 +57,7 @@ func (pkg *Package) gitCheckoutVersion(version string) (err error) { } // -// gitClone the package into "$GOPATH/src/{ImportPath}". +// gitClone the package into "{prefix}/src/{ImportPath}". // If destination directory is not empty it will return an error. // func (pkg *Package) gitClone() (err error) { @@ -238,7 +238,7 @@ func (pkg *Package) gitGetTagLatest() (tag string, err error) { } // -// gitInstall the package into GOPATH source directory. +// gitInstall the package into source directory. // func (pkg *Package) gitInstall() (err error) { err = pkg.gitClone() diff --git a/package_test.go b/package_test.go index 9492bd0..8738cbb 100644 --- a/package_test.go +++ b/package_test.go @@ -29,7 +29,7 @@ func testPackageRemove(t *testing.T) { t.Log(c.desc) if len(c.pkgName) > 0 { - c.pkg, _ = NewPackage(c.pkgName, c.pkgName) + c.pkg, _ = NewPackage(testEnv, c.pkgName, c.pkgName) } err := c.pkg.Remove() @@ -742,7 +742,7 @@ func testPackageGoClean(t *testing.T) { t.Log(c.desc) if len(c.pkgName) > 0 { - c.pkg, _ = NewPackage(c.pkgName, c.pkgName) + c.pkg, _ = NewPackage(testEnv, c.pkgName, c.pkgName) } err = c.pkg.GoClean() diff --git a/testdata/beku.db b/testdata/beku.db index e4fec16..2e4d589 100644 --- a/testdata/beku.db +++ b/testdata/beku.db @@ -1,4 +1,5 @@ [beku] +vendor = false [package "github.com/alecthomas/gometalinter"] vcs = git |
