зеркало из https://github.com/mislav/hub.git
go compat
This commit is contained in:
Родитель
af7150924e
Коммит
5d42499f1d
|
@ -504,9 +504,9 @@ Feature: OAuth authentication
|
|||
Scenario: Config file is not writeable, should exit before asking for credentials
|
||||
Given $HUB_CONFIG is "/InvalidConfigFile"
|
||||
When I run `hub create` interactively
|
||||
Then the output should contain exactly:
|
||||
Then the output should contain:
|
||||
"""
|
||||
open /InvalidConfigFile: permission denied\n
|
||||
open /InvalidConfigFile:
|
||||
"""
|
||||
And the exit status should be 1
|
||||
And the file "../home/.config/hub" should not exist
|
||||
|
|
|
@ -35,6 +35,8 @@ type Host struct {
|
|||
|
||||
type Config struct {
|
||||
Hosts []*Host `toml:"hosts"`
|
||||
|
||||
stdinScanner *bufio.Scanner
|
||||
}
|
||||
|
||||
func (c *Config) PromptForHost(host string) (h *Host, err error) {
|
||||
|
@ -181,8 +183,11 @@ func (c *Config) PromptForOTP() string {
|
|||
}
|
||||
|
||||
func (c *Config) scanLine() string {
|
||||
if c.stdinScanner == nil {
|
||||
c.stdinScanner = bufio.NewScanner(os.Stdin)
|
||||
}
|
||||
var line string
|
||||
scanner := bufio.NewScanner(os.Stdin)
|
||||
scanner := c.stdinScanner
|
||||
if scanner.Scan() {
|
||||
line = scanner.Text()
|
||||
}
|
||||
|
|
2
go.mod
2
go.mod
|
@ -14,6 +14,6 @@ require (
|
|||
github.com/shurcooL/sanitized_anchor_name v0.0.0-20170918181015-86672fcb3f95 // indirect
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2
|
||||
golang.org/x/net v0.0.0-20191002035440-2ec189313ef0
|
||||
golang.org/x/sys v0.0.0-20190531175056-4c3a928424d2 // indirect
|
||||
golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8 // indirect
|
||||
gopkg.in/yaml.v2 v2.0.0-20190319135612-7b8349ac747c
|
||||
)
|
||||
|
|
4
go.sum
4
go.sum
|
@ -21,8 +21,8 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk
|
|||
golang.org/x/net v0.0.0-20191002035440-2ec189313ef0 h1:2mqDk8w/o6UmeUCu5Qiq2y7iMf6anbx+YA8d1JFoFrs=
|
||||
golang.org/x/net v0.0.0-20191002035440-2ec189313ef0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190531175056-4c3a928424d2 h1:T5DasATyLQfmbTpfEXx/IOL9vfjzW6up+ZDkmHvIf2s=
|
||||
golang.org/x/sys v0.0.0-20190531175056-4c3a928424d2/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8 h1:OH54vjqzRWmbJ62fjuhxy7AxFFgoHN0/DPc/UrL8cAs=
|
||||
golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
|
||||
|
|
Загрузка…
Ссылка в новой задаче