Skip to content

Commit 58f1a71

Browse files
committed
fixed linter warnings
1 parent 6fcdf4e commit 58f1a71

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

api/api.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,8 @@ type Api struct {
3737

3838
func NewApi(opts ...func(*ApiOptions)) *Api {
3939
var options = &ApiOptions{}
40-
if opts != nil {
41-
for _, opt := range opts {
42-
opt(options)
43-
}
40+
for _, opt := range opts {
41+
opt(options)
4442
}
4543

4644
tr := &http.Transport{}
@@ -60,7 +58,7 @@ func (a *Api) saveSession(host string, session *Session) {
6058
}
6159

6260
func (a *Api) getSession(host string) *Session {
63-
session, _ := a.sessions[host]
61+
session := a.sessions[host]
6462
return session
6563
}
6664

config/profile.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ func newConfig() *Config {
2626

2727
var Cfg *Config
2828

29-
func init() {
29+
func Load() error {
3030
Cfg = newConfig()
31-
Cfg.Load()
31+
return Cfg.Load()
3232
}
3333

3434
func (c *Config) AddProfile(profile *Profile) {

main.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"os"
77

88
"github.com/MrZoidberg/megarac/cmd"
9+
"github.com/MrZoidberg/megarac/config"
910
"github.com/MrZoidberg/megarac/lgr"
1011
"github.com/urfave/cli/v2"
1112
)
@@ -15,13 +16,16 @@ var revision = "latest"
1516
func main() {
1617

1718
lgr.SetupLog()
19+
err := config.Load()
20+
if err != nil {
21+
log.Fatalf("Failed to load configuration: %v", err)
22+
}
1823

1924
app := &cli.App{
2025
Name: "megarac",
2126
Usage: "cli tool for managing MegaRAC BMCs",
2227
Action: func(cCtx *cli.Context) error {
23-
cli.ShowAppHelp(cCtx)
24-
return nil
28+
return cli.ShowAppHelp(cCtx)
2529
},
2630
Commands: []*cli.Command{
2731
{

0 commit comments

Comments
 (0)