1 Star 0 Fork 0

krypln/govendor

Create your Gitee Account
Explore and code with more than 13.5 million developers,Free private repositories !:)
Sign up
文件
Clone or Download
pkg.go 1.01 KB
Copy Edit Raw Blame History
Cameron Moore authored 2016-09-17 03:45 +08:00 . run: add file path (-p) option to list
// 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 pkgspec defines a schema that contains the path, origin, version
// and other properties.
package pkgspec
import "bytes"
type Pkg struct {
Path string
FilePath string
Origin string
IncludeTree bool
MatchTree bool
HasVersion bool
HasOrigin bool
Version string
Uncommitted bool
}
func (pkg *Pkg) String() string {
buf := &bytes.Buffer{}
buf.WriteString(pkg.Path)
if pkg.IncludeTree {
buf.WriteString(TreeIncludeSuffix)
} else if pkg.MatchTree {
buf.WriteString(TreeMatchSuffix)
}
if len(pkg.Origin) > 0 {
buf.WriteString(originMatch)
buf.WriteString(pkg.Origin)
}
if pkg.HasVersion {
buf.WriteString(versionMatch)
if len(pkg.Version) > 0 {
buf.WriteString(pkg.Version)
}
}
return buf.String()
}
func (pkg *Pkg) PathOrigin() string {
if len(pkg.Origin) > 0 {
return pkg.Origin
}
return pkg.Path
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/krypln/govendor.git
git@gitee.com:krypln/govendor.git
krypln
govendor
govendor
v1.0.9

Search