mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 02:41:25 +00:00
updating github.com/mattn/go-shellwords to v1.0.5
This commit is contained in:
parent
b713287e43
commit
1a5cfb7aca
4
go.mod
4
go.mod
@ -96,7 +96,7 @@ require (
|
||||
github.com/lithammer/dedent v1.1.0
|
||||
github.com/lpabon/godbc v0.1.1 // indirect
|
||||
github.com/magiconair/properties v1.8.1 // indirect
|
||||
github.com/mattn/go-shellwords v0.0.0-20180605041737-f8471b0a71de // indirect
|
||||
github.com/mattn/go-shellwords v1.0.5 // indirect
|
||||
github.com/mesos/mesos-go v0.0.9 // indirect
|
||||
github.com/mholt/caddy v0.0.0-20180213163048-2de495001514
|
||||
github.com/miekg/dns v0.0.0-20160614162101-5d001d020961
|
||||
@ -323,7 +323,7 @@ replace (
|
||||
github.com/magiconair/properties => github.com/magiconair/properties v1.8.1
|
||||
github.com/mailru/easyjson => github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329
|
||||
github.com/marstr/guid => github.com/marstr/guid v0.0.0-20170427235115-8bdf7d1a087c
|
||||
github.com/mattn/go-shellwords => github.com/mattn/go-shellwords v0.0.0-20180605041737-f8471b0a71de
|
||||
github.com/mattn/go-shellwords => github.com/mattn/go-shellwords v1.0.5
|
||||
github.com/matttproud/golang_protobuf_extensions => github.com/matttproud/golang_protobuf_extensions v1.0.1
|
||||
github.com/mesos/mesos-go => github.com/mesos/mesos-go v0.0.9
|
||||
github.com/mholt/caddy => github.com/mholt/caddy v0.0.0-20180213163048-2de495001514
|
||||
|
4
go.sum
4
go.sum
@ -255,8 +255,8 @@ github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329 h1:2gxZ0XQIU/5z3Z3
|
||||
github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
|
||||
github.com/marstr/guid v0.0.0-20170427235115-8bdf7d1a087c h1:N7uWGS2fTwH/4BwxbHiJZNAFTSJ5yPU0emHsQWvkxEY=
|
||||
github.com/marstr/guid v0.0.0-20170427235115-8bdf7d1a087c/go.mod h1:74gB1z2wpxxInTG6yaqA7KrtM0NZ+RbrcqDvYHefzho=
|
||||
github.com/mattn/go-shellwords v0.0.0-20180605041737-f8471b0a71de h1:ryDLMbZGgf2bSdLfdQFaJuuP4No40cDUt62Mdv+3TW8=
|
||||
github.com/mattn/go-shellwords v0.0.0-20180605041737-f8471b0a71de/go.mod h1:3xCvwCdWdlDJUrvuMn7Wuy9eWs4pE8vqg+NOMyg4B2o=
|
||||
github.com/mattn/go-shellwords v1.0.5 h1:JhhFTIOslh5ZsPrpa3Wdg8bF0WI3b44EMblmU9wIsXc=
|
||||
github.com/mattn/go-shellwords v1.0.5/go.mod h1:3xCvwCdWdlDJUrvuMn7Wuy9eWs4pE8vqg+NOMyg4B2o=
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
|
||||
github.com/mesos/mesos-go v0.0.9 h1:w8V5sOEnxzHZ2kAOy273v/HgbolyI6XI+qe5jx5u+Y0=
|
||||
|
1
vendor/github.com/mattn/go-shellwords/go.mod
generated
vendored
Normal file
1
vendor/github.com/mattn/go-shellwords/go.mod
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
module github.com/mattn/go-shellwords
|
31
vendor/github.com/mattn/go-shellwords/shellwords.go
generated
vendored
31
vendor/github.com/mattn/go-shellwords/shellwords.go
generated
vendored
@ -4,6 +4,7 @@ import (
|
||||
"errors"
|
||||
"os"
|
||||
"regexp"
|
||||
"strings"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -21,13 +22,17 @@ func isSpace(r rune) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func replaceEnv(s string) string {
|
||||
func replaceEnv(getenv func(string) string, s string) string {
|
||||
if getenv == nil {
|
||||
getenv = os.Getenv
|
||||
}
|
||||
|
||||
return envRe.ReplaceAllStringFunc(s, func(s string) string {
|
||||
s = s[1:]
|
||||
if s[0] == '{' {
|
||||
s = s[1 : len(s)-1]
|
||||
}
|
||||
return os.Getenv(s)
|
||||
return getenv(s)
|
||||
})
|
||||
}
|
||||
|
||||
@ -35,10 +40,18 @@ type Parser struct {
|
||||
ParseEnv bool
|
||||
ParseBacktick bool
|
||||
Position int
|
||||
|
||||
// If ParseEnv is true, use this for getenv.
|
||||
// If nil, use os.Getenv.
|
||||
Getenv func(string) string
|
||||
}
|
||||
|
||||
func NewParser() *Parser {
|
||||
return &Parser{ParseEnv, ParseBacktick, 0}
|
||||
return &Parser{
|
||||
ParseEnv: ParseEnv,
|
||||
ParseBacktick: ParseBacktick,
|
||||
Position: 0,
|
||||
}
|
||||
}
|
||||
|
||||
func (p *Parser) Parse(line string) ([]string, error) {
|
||||
@ -73,7 +86,7 @@ loop:
|
||||
backtick += string(r)
|
||||
} else if got {
|
||||
if p.ParseEnv {
|
||||
buf = replaceEnv(buf)
|
||||
buf = replaceEnv(p.Getenv, buf)
|
||||
}
|
||||
args = append(args, buf)
|
||||
buf = ""
|
||||
@ -108,7 +121,11 @@ loop:
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
buf = out
|
||||
if r == ')' {
|
||||
buf = buf[:len(buf)-len(backtick)-2] + out
|
||||
} else {
|
||||
buf = buf[:len(buf)-len(backtick)-1] + out
|
||||
}
|
||||
}
|
||||
backtick = ""
|
||||
dollarQuote = !dollarQuote
|
||||
@ -119,7 +136,7 @@ loop:
|
||||
}
|
||||
case '(':
|
||||
if !singleQuoted && !doubleQuoted && !backQuote {
|
||||
if !dollarQuote && len(buf) > 0 && buf == "$" {
|
||||
if !dollarQuote && strings.HasSuffix(buf, "$") {
|
||||
dollarQuote = true
|
||||
buf += "("
|
||||
continue
|
||||
@ -159,7 +176,7 @@ loop:
|
||||
|
||||
if got {
|
||||
if p.ParseEnv {
|
||||
buf = replaceEnv(buf)
|
||||
buf = replaceEnv(p.Getenv, buf)
|
||||
}
|
||||
args = append(args, buf)
|
||||
}
|
||||
|
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
@ -588,7 +588,7 @@ github.com/mailru/easyjson/jlexer
|
||||
github.com/mailru/easyjson/jwriter
|
||||
# github.com/marstr/guid v0.0.0-20170427235115-8bdf7d1a087c => github.com/marstr/guid v0.0.0-20170427235115-8bdf7d1a087c
|
||||
github.com/marstr/guid
|
||||
# github.com/mattn/go-shellwords v0.0.0-20180605041737-f8471b0a71de => github.com/mattn/go-shellwords v0.0.0-20180605041737-f8471b0a71de
|
||||
# github.com/mattn/go-shellwords v1.0.5 => github.com/mattn/go-shellwords v1.0.5
|
||||
github.com/mattn/go-shellwords
|
||||
# github.com/matttproud/golang_protobuf_extensions v1.0.1 => github.com/matttproud/golang_protobuf_extensions v1.0.1
|
||||
github.com/matttproud/golang_protobuf_extensions/pbutil
|
||||
|
Loading…
Reference in New Issue
Block a user