Fixed formatting via gofmt

Signed-off-by: David J. Allen <davidallendj@gmail.com>
This commit is contained in:
David Allen 2023-09-15 08:32:41 -06:00
parent ac9556a526
commit b3368e5264
11 changed files with 94 additions and 103 deletions

View file

@ -10,7 +10,6 @@ import (
"github.com/spf13/cobra"
)
var collectCmd = &cobra.Command{
Use: "collect",
Short: "Query information about BMC",
@ -47,7 +46,7 @@ var collectCmd = &cobra.Command{
},
}
func init(){
func init() {
collectCmd.PersistentFlags().StringSliceVar(&drivers, "driver", []string{"redfish"}, "set the driver(s) and fallback drivers to use")
collectCmd.PersistentFlags().StringVar(&smd.Host, "host", smd.Host, "set the host to the smd API")
collectCmd.PersistentFlags().IntVar(&smd.Port, "port", smd.Port, "set the port to the smd API")

View file

@ -8,7 +8,6 @@ import (
"github.com/spf13/cobra"
)
var listCmd = &cobra.Command{
Use: "list",
Short: "List information from scan",

View file

@ -15,7 +15,6 @@ var (
Port = 27779
)
func makeEndpointUrl(endpoint string) string {
return Host + ":" + fmt.Sprint(Port) + BaseEndpoint + endpoint
}

View file

@ -7,7 +7,6 @@ import (
"net/http"
)
func MakeRequest(url string, httpMethod string, body []byte, headers map[string]string) (*http.Response, []byte, error) {
// url := getSmdEndpointUrl(endpoint)
req, _ := http.NewRequest(httpMethod, url, bytes.NewBuffer(body))

View file

@ -132,7 +132,7 @@ func CollectInfo(probeStates *[]BMCProbeResult, l *Logger, q *QueryParams) error
for i := 0; i < q.Threads; i++ {
go func() {
for {
ps, ok := <- chanProbeState
ps, ok := <-chanProbeState
if !ok {
wg.Done()
return
@ -222,7 +222,7 @@ func CollectInfo(probeStates *[]BMCProbeResult, l *Logger, q *QueryParams) error
for _, ps := range *probeStates {
// skip if found info from host
foundHost := slices.Index(found, ps.Host)
if !ps.State || foundHost >= 0{
if !ps.State || foundHost >= 0 {
continue
}
chanProbeState <- ps
@ -417,7 +417,7 @@ func QueryChassis(q *QueryParams) ([]byte, error) {
url += fmt.Sprintf("%s:%s@", q.User, q.Pass)
}
url += fmt.Sprintf("%s:%d", q.Host, q.Port)
config := gofish.ClientConfig {
config := gofish.ClientConfig{
Endpoint: url,
Username: q.User,
Password: q.Pass,

View file

@ -4,13 +4,11 @@ import (
"github.com/sirupsen/logrus"
)
type Logger struct {
Log *logrus.Logger
Path string
}
func NewLogger(l *logrus.Logger, level logrus.Level) *Logger {
l.SetLevel(level)
return &Logger{
@ -19,8 +17,6 @@ func NewLogger(l *logrus.Logger, level logrus.Level) *Logger {
}
}
func (l *Logger)WriteFile(path string) {
func (l *Logger) WriteFile(path string) {
}

View file

@ -7,7 +7,6 @@ import (
"time"
)
func rawConnect(host string, ports []int, timeout int, keepOpenOnly bool) []BMCProbeResult {
results := []BMCProbeResult{}
for _, p := range ports {