d7a3a090df
From the 1.17 release notes (https://golang.org/doc/go1.17#gofmt): gofmt (and go fmt) now synchronizes //go:build lines with // +build lines. More info about this change can be found at https://golang.org/design/draft-gobuild
31 lines
483 B
Go
31 lines
483 B
Go
//go:build testtools
|
|
// +build testtools
|
|
|
|
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"strings"
|
|
)
|
|
|
|
func main() {
|
|
prompt := strings.Join(os.Args[1:], " ")
|
|
|
|
var answer string
|
|
|
|
if strings.Contains(prompt, "Username") {
|
|
answer = "user"
|
|
if env, ok := os.LookupEnv("LFS_ASKPASS_USERNAME"); ok {
|
|
answer = env
|
|
}
|
|
} else if strings.Contains(prompt, "Password") {
|
|
answer = "pass"
|
|
if env, ok := os.LookupEnv("LFS_ASKPASS_PASSWORD"); ok {
|
|
answer = env
|
|
}
|
|
}
|
|
|
|
fmt.Println(answer)
|
|
}
|