Skip to content

Commit

Permalink
fix nil pointer config
Browse files Browse the repository at this point in the history
  • Loading branch information
zyxkad committed Aug 17, 2024
1 parent d436d88 commit 8698d11
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
8 changes: 3 additions & 5 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,17 +98,15 @@ func main() {
defer log.RecordPanic()
log.StartFlushLogFile()

r := NewRunner()

ctx, cancel := context.WithCancel(context.Background())

if config, err := readAndRewriteConfig(); err != nil {
config, err := readAndRewriteConfig()

Check failure on line 103 in main.go

View workflow job for this annotation

GitHub Actions / test

declared and not used: config
if err != nil {
log.Errorf("Config error: %s", err)
os.Exit(1)
} else {
r.Config = config
}

r := NewRunner(cfg)

Check failure on line 109 in main.go

View workflow job for this annotation

GitHub Actions / test

undefined: cfg
r.SetupLogger(ctx)

log.TrInfof("program.starting", build.ClusterVersion, build.BuildVersion)
Expand Down
3 changes: 2 additions & 1 deletion runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,10 @@ type Runner struct {
tunnelCancel context.CancelFunc
}

func NewRunner() *Runner {
func NewRunner(cfg *config.Config) *Runner {
r := new(Runner)

r.Config = cfg
r.configHandler = &ConfigHandler{r: r}

var dialer *net.Dialer
Expand Down

0 comments on commit 8698d11

Please sign in to comment.