mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #14801 from HuKeping/golint
golint: use golint to check package util
This commit is contained in:
commit
06b922c63f
4 changed files with 10 additions and 4 deletions
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
package utils
|
package utils
|
||||||
|
|
||||||
|
// ExperimentalBuild is a stub which always returns true for
|
||||||
|
// builds that include the "experimental" build tag
|
||||||
func ExperimentalBuild() bool {
|
func ExperimentalBuild() bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,8 @@ import (
|
||||||
"github.com/docker/docker/pkg/urlutil"
|
"github.com/docker/docker/pkg/urlutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// GitClone clones a repository into a newly created directory which
|
||||||
|
// will be under "docker-build-git"
|
||||||
func GitClone(remoteURL string) (string, error) {
|
func GitClone(remoteURL string) (string, error) {
|
||||||
if !urlutil.IsGitTransport(remoteURL) {
|
if !urlutil.IsGitTransport(remoteURL) {
|
||||||
remoteURL = "https://" + remoteURL
|
remoteURL = "https://" + remoteURL
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
package utils
|
package utils
|
||||||
|
|
||||||
|
// ExperimentalBuild is a stub which always returns false for
|
||||||
|
// builds that do not include the "experimental" build tag
|
||||||
func ExperimentalBuild() bool {
|
func ExperimentalBuild() bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ import (
|
||||||
"github.com/docker/docker/pkg/stringid"
|
"github.com/docker/docker/pkg/stringid"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Figure out the absolute path of our own binary (if it's still around).
|
// SelfPath figures out the absolute path of our own binary (if it's still around).
|
||||||
func SelfPath() string {
|
func SelfPath() string {
|
||||||
path, err := exec.LookPath(os.Args[0])
|
path, err := exec.LookPath(os.Args[0])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -79,7 +79,7 @@ func isValidDockerInitPath(target string, selfPath string) bool { // target and
|
||||||
return dockerversion.INITSHA1 != "" && dockerInitSha1(target) == dockerversion.INITSHA1
|
return dockerversion.INITSHA1 != "" && dockerInitSha1(target) == dockerversion.INITSHA1
|
||||||
}
|
}
|
||||||
|
|
||||||
// Figure out the path of our dockerinit (which may be SelfPath())
|
// DockerInitPath figures out the path of our dockerinit (which may be SelfPath())
|
||||||
func DockerInitPath(localCopy string) string {
|
func DockerInitPath(localCopy string) string {
|
||||||
selfPath := SelfPath()
|
selfPath := SelfPath()
|
||||||
if isValidDockerInitPath(selfPath, selfPath) {
|
if isValidDockerInitPath(selfPath, selfPath) {
|
||||||
|
@ -157,7 +157,7 @@ func GetCallerName(depth int) string {
|
||||||
return callerShortName
|
return callerShortName
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReplaceOrAppendValues returns the defaults with the overrides either
|
// ReplaceOrAppendEnvValues returns the defaults with the overrides either
|
||||||
// replaced by env key or appended to the list
|
// replaced by env key or appended to the list
|
||||||
func ReplaceOrAppendEnvValues(defaults, overrides []string) []string {
|
func ReplaceOrAppendEnvValues(defaults, overrides []string) []string {
|
||||||
cache := make(map[string]int, len(defaults))
|
cache := make(map[string]int, len(defaults))
|
||||||
|
@ -239,7 +239,7 @@ func ValidateContextDirectory(srcPath string, excludes []string) error {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reads a .dockerignore file and returns the list of file patterns
|
// ReadDockerIgnore reads a .dockerignore file and returns the list of file patterns
|
||||||
// to ignore. Note this will trim whitespace from each line as well
|
// to ignore. Note this will trim whitespace from each line as well
|
||||||
// as use GO's "clean" func to get the shortest/cleanest path for each.
|
// as use GO's "clean" func to get the shortest/cleanest path for each.
|
||||||
func ReadDockerIgnore(path string) ([]string, error) {
|
func ReadDockerIgnore(path string) ([]string, error) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue