Make linter happy
This commit is contained in:
parent
b2090f636a
commit
784c661c0c
|
@ -43,9 +43,15 @@ import (
|
|||
"github.com/pulumi/pulumi/sdk/v3/python"
|
||||
)
|
||||
|
||||
const (
|
||||
langPython = "python"
|
||||
langNodejs = "nodejs"
|
||||
langDotnet = "dotnet"
|
||||
)
|
||||
|
||||
func newAboutCmd() *cobra.Command {
|
||||
var jsonOut bool
|
||||
short := "Print information about the Pulumi enviroment."
|
||||
short := "Print information about the Pulumi environment."
|
||||
cmd :=
|
||||
&cobra.Command{
|
||||
Use: "about",
|
||||
|
@ -65,9 +71,8 @@ func newAboutCmd() *cobra.Command {
|
|||
summary := getSummaryAbout()
|
||||
if jsonOut {
|
||||
return printJSON(summary)
|
||||
} else {
|
||||
summary.Print()
|
||||
}
|
||||
summary.Print()
|
||||
return nil
|
||||
},
|
||||
),
|
||||
|
@ -261,9 +266,9 @@ func (host hostAbout) String() string {
|
|||
return cmdutil.Table{
|
||||
Headers: []string{"Host", ""},
|
||||
Rows: simpleTableRows([][]string{
|
||||
[]string{"OS", host.Os},
|
||||
[]string{"Version", host.Version},
|
||||
[]string{"Arch", host.Arch},
|
||||
{"OS", host.Os},
|
||||
{"Version", host.Version},
|
||||
{"Arch", host.Arch},
|
||||
})}.String()
|
||||
}
|
||||
|
||||
|
@ -291,9 +296,9 @@ func (b backendAbout) String() string {
|
|||
return cmdutil.Table{
|
||||
Headers: []string{"Backend", ""},
|
||||
Rows: simpleTableRows([][]string{
|
||||
[]string{"Name", b.Name},
|
||||
[]string{"URL", b.URL},
|
||||
[]string{"User", b.User},
|
||||
{"Name", b.Name},
|
||||
{"URL", b.URL},
|
||||
{"User", b.User},
|
||||
}),
|
||||
}.String()
|
||||
}
|
||||
|
@ -358,7 +363,7 @@ func (current currentStackAbout) String() string {
|
|||
rows := make([]cmdutil.TableRow, len(current.Resources))
|
||||
for i, r := range current.Resources {
|
||||
rows[i] = cmdutil.TableRow{
|
||||
Columns: []string{string(r.Type), string(r.URN)},
|
||||
Columns: []string{r.Type, r.URN},
|
||||
}
|
||||
}
|
||||
resources = cmdutil.Table{
|
||||
|
@ -373,7 +378,7 @@ func (current currentStackAbout) String() string {
|
|||
rows := make([]cmdutil.TableRow, len(current.PendingOps))
|
||||
for i, r := range current.PendingOps {
|
||||
rows[i] = cmdutil.TableRow{
|
||||
Columns: []string{string(r.Type), string(r.URN)},
|
||||
Columns: []string{r.Type, r.URN},
|
||||
}
|
||||
}
|
||||
pending = cmdutil.Table{
|
||||
|
@ -397,15 +402,15 @@ func simpleTableRows(arr [][]string) []cmdutil.TableRow {
|
|||
// This does not have an associated struct. It also does not make sense to
|
||||
// serialize.
|
||||
func formatProgramDependenciesAbout(language, root string) (string, error) {
|
||||
var depInfo = ""
|
||||
var depInfo string
|
||||
switch language {
|
||||
case "nodejs":
|
||||
case langNodejs:
|
||||
depInfo = "package.json"
|
||||
case "python":
|
||||
case langPython:
|
||||
depInfo = "requirements.txt"
|
||||
case "go":
|
||||
depInfo = "go.mod"
|
||||
case "dotnet":
|
||||
case langDotnet:
|
||||
return fmt.Sprintf("Please include the result of \"dotnet list package\""), nil
|
||||
default:
|
||||
return "", errors.New(fmt.Sprintf("Unknown Language: %s", language))
|
||||
|
@ -434,9 +439,9 @@ func (cli cliAbout) String() string {
|
|||
return cmdutil.Table{
|
||||
Headers: []string{"CLI", ""},
|
||||
Rows: simpleTableRows([][]string{
|
||||
[]string{"Version", cli.Version.String()},
|
||||
[]string{"Go Version", cli.GoVersion},
|
||||
[]string{"Go Compiler", cli.GoCompiler},
|
||||
{"Version", cli.Version.String()},
|
||||
{"Go Version", cli.GoVersion},
|
||||
{"Go Compiler", cli.GoCompiler},
|
||||
}),
|
||||
}.String()
|
||||
}
|
||||
|
@ -445,9 +450,8 @@ func formatLogAbout() string {
|
|||
logDir := flag.Lookup("log_dir")
|
||||
if logDir != nil && logDir.Value.String() != "" {
|
||||
return fmt.Sprintf("Pulumi locates its logs in %s", logDir)
|
||||
} else {
|
||||
return fmt.Sprintf("Pulumi locates its logs in %s by default", os.TempDir())
|
||||
}
|
||||
return fmt.Sprintf("Pulumi locates its logs in %s by default", os.TempDir())
|
||||
}
|
||||
|
||||
type projectRuntimeAbout struct {
|
||||
|
@ -460,20 +464,20 @@ type projectRuntimeAbout struct {
|
|||
func getProjectRuntimeAbout(proj *workspace.Project) (projectRuntimeAbout, error) {
|
||||
var ex, version string
|
||||
var err error
|
||||
var out []byte
|
||||
language := proj.Runtime.Name()
|
||||
switch language {
|
||||
case "nodejs":
|
||||
case langNodejs:
|
||||
ex, err = executable.FindExecutable("node")
|
||||
if err != nil {
|
||||
return projectRuntimeAbout{}, errors.Wrap(err, "Could not find node executable")
|
||||
}
|
||||
cmd := exec.Command(ex, "--version")
|
||||
if out, err := cmd.Output(); err != nil {
|
||||
if out, err = cmd.Output(); err != nil {
|
||||
return projectRuntimeAbout{}, errors.Wrap(err, "Failed to get node version")
|
||||
} else {
|
||||
version = string(out)
|
||||
}
|
||||
case "python":
|
||||
version = string(out)
|
||||
case langPython:
|
||||
var cmd *exec.Cmd
|
||||
// if CommandPath has an error, then so will Command. The error can
|
||||
// therefore be ignored as redundant.
|
||||
|
@ -482,33 +486,30 @@ func getProjectRuntimeAbout(proj *workspace.Project) (projectRuntimeAbout, error
|
|||
if err != nil {
|
||||
return projectRuntimeAbout{}, err
|
||||
}
|
||||
if out, err := cmd.Output(); err != nil {
|
||||
if out, err = cmd.Output(); err != nil {
|
||||
return projectRuntimeAbout{}, errors.Wrap(err, "Failed to get python version")
|
||||
} else {
|
||||
version = "v" + strings.TrimPrefix(string(out), "Python ")
|
||||
}
|
||||
version = "v" + strings.TrimPrefix(string(out), "Python ")
|
||||
case "go":
|
||||
ex, err = executable.FindExecutable("go")
|
||||
if err != nil {
|
||||
return projectRuntimeAbout{}, errors.Wrap(err, "Could not find python executable")
|
||||
}
|
||||
cmd := exec.Command(ex, "version")
|
||||
if out, err := cmd.Output(); err != nil {
|
||||
if out, err = cmd.Output(); err != nil {
|
||||
return projectRuntimeAbout{}, errors.Wrap(err, "Failed to get go version")
|
||||
} else {
|
||||
version = "v" + strings.TrimPrefix(string(out), "go version go")
|
||||
}
|
||||
case "dotnet":
|
||||
version = "v" + strings.TrimPrefix(string(out), "go version go")
|
||||
case langDotnet:
|
||||
ex, err = executable.FindExecutable("dotnet")
|
||||
if err != nil {
|
||||
return projectRuntimeAbout{}, errors.Wrap(err, "Could not find dotnet executable")
|
||||
}
|
||||
cmd := exec.Command(ex, "--version")
|
||||
if out, err := cmd.Output(); err != nil {
|
||||
if out, err = cmd.Output(); err != nil {
|
||||
return projectRuntimeAbout{}, errors.Wrap(err, "Failed to get dotnet version")
|
||||
} else {
|
||||
version = "v" + string(out)
|
||||
}
|
||||
version = "v" + string(out)
|
||||
default:
|
||||
return projectRuntimeAbout{}, errors.New(fmt.Sprintf("Unknown Language: %s", language))
|
||||
}
|
||||
|
|
|
@ -106,6 +106,7 @@ github.com/Microsoft/hcsshim v0.8.9/go.mod h1:5692vkUqntj1idxauYlpoINNKeqCiG6Sg3
|
|||
github.com/Netflix/go-expect v0.0.0-20180615182759-c93bf25de8e8 h1:xzYJEypr/85nBpB11F9br+3HUrpgb+fcm5iADzXXYEw=
|
||||
github.com/Netflix/go-expect v0.0.0-20180615182759-c93bf25de8e8/go.mod h1:oX5x61PbNXchhh0oikYAH+4Pcfw5LKv21+Jnpr6r6Pc=
|
||||
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
|
||||
github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9SBzvHz7e8=
|
||||
github.com/agext/levenshtein v1.2.1 h1:QmvMAjj2aEICytGiWzmxoE0x2KZvE0fvmqMOfy2tjT8=
|
||||
github.com/agext/levenshtein v1.2.1/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558=
|
||||
github.com/alcortesm/tgz v0.0.0-20161220082320-9c5fe88206d7 h1:uSoVVbwJiQipAclBbw+8quDsfcvFjOpI5iCf4p/cqCs=
|
||||
|
@ -234,6 +235,7 @@ github.com/go-ldap/ldap/v3 v3.1.3/go.mod h1:3rbOH3jRS2u6jg2rJnKAMLE/xQyCKIveG2Sa
|
|||
github.com/go-ldap/ldap/v3 v3.1.10/go.mod h1:5Zun81jBTabRaI8lzN7E1JjyEl1g6zI6u9pd8luAK4Q=
|
||||
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
|
||||
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
|
||||
github.com/go-ole/go-ole v1.2.5/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
|
||||
github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
|
||||
github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8=
|
||||
github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA=
|
||||
|
@ -578,6 +580,7 @@ github.com/sabhiram/go-gitignore v0.0.0-20180611051255-d3107576ba94/go.mod h1:b1
|
|||
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
|
||||
github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
|
||||
github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
|
||||
github.com/shirou/gopsutil v3.21.7+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
|
||||
github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749/go.mod h1:ZY1cvUeJuFPAdZ/B6v7RHavJWZn2YPVFQ1OSXhCGOkg=
|
||||
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
|
||||
github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546/go.mod h1:TrYk7fJVaAttu97ZZKrO9UbRa8izdowaMIZcxYMbVaw=
|
||||
|
@ -617,6 +620,8 @@ github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5Cc
|
|||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/texttheater/golang-levenshtein v0.0.0-20191208221605-eb6844b05fc6 h1:9VTskZOIRf2vKF3UL8TuWElry5pgUpV1tFSe/e/0m/E=
|
||||
github.com/texttheater/golang-levenshtein v0.0.0-20191208221605-eb6844b05fc6/go.mod h1:XDKHRm5ThF8YJjx001LtgelzsoaEcvnA7lVWz9EeX3g=
|
||||
github.com/tklauser/go-sysconf v0.3.8/go.mod h1:z4zYWRS+X53WUKtBcmDg1comV3fPhdQnzasnIHUoLDU=
|
||||
github.com/tklauser/numcpus v0.2.3/go.mod h1:vpEPS/JC+oZGGQ/My/vJnNsvMDQL6PwOqt8dsCw5j+E=
|
||||
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
|
||||
github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM=
|
||||
github.com/tweekmonster/luser v0.0.0-20161003172636-3fa38070dbd7 h1:X9dsIWPuuEJlPX//UmRKophhOKCGXc46RVIGuttks68=
|
||||
|
@ -867,6 +872,8 @@ golang.org/x/sys v0.0.0-20210420205809-ac73e9fd8988/go.mod h1:h1NjWce9XRLGQEsW7w
|
|||
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210503080704-8803ae5d1324/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210503173754-0981d6026fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210816074244-15123e1e1f71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210817190340-bfb29a6856f2 h1:c8PlLMqBbOHoqtjteWm5/kbe6rNY2pbRfbIMVnepueo=
|
||||
golang.org/x/sys v0.0.0-20210817190340-bfb29a6856f2/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
|
||||
|
|
Loading…
Reference in a new issue