Skip to content

Commit 65724b7

Browse files
committed
Redo static manager access
1 parent e6c307d commit 65724b7

File tree

4 files changed

+19
-4
lines changed

4 files changed

+19
-4
lines changed

go.mod

+1-2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ require (
4242
github.com/cyphar/filepath-securejoin v0.4.0 // indirect
4343
github.com/davidmz/go-pageant v1.0.2 // indirect
4444
github.com/go-fed/httpsig v1.1.0 // indirect
45-
github.com/go-viper/mapstructure/v2 v2.2.1 // indirect
4645
github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect
4746
github.com/google/go-github/v30 v30.1.0 // indirect
4847
github.com/google/go-querystring v1.1.0 // indirect
@@ -99,7 +98,7 @@ require (
9998
github.com/mattn/go-colorable v0.1.14 // indirect
10099
github.com/mattn/go-isatty v0.0.20 // indirect
101100
github.com/mattn/go-runewidth v0.0.15 // indirect
102-
github.com/mitchellh/mapstructure v1.5.0 // indirect
101+
github.com/mitchellh/mapstructure v1.5.0
103102
github.com/nats-io/nats.go v1.38.0
104103
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
105104
github.com/pterm/pterm v0.12.79

go.sum

-2
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,6 @@ github.com/go-git/go-git/v5 v5.13.2 h1:7O7xvsK7K+rZPKW6AQR1YyNhfywkv7B8/FsP3ki6Z
9595
github.com/go-git/go-git/v5 v5.13.2/go.mod h1:hWdW5P4YZRjmpGHwRH2v3zkWcNl6HeXaXQEMGb3NJ9A=
9696
github.com/go-sourcemap/sourcemap v2.1.4+incompatible h1:a+iTbH5auLKxaNwQFg0B+TCYl6lbukKPc7b5x0n1s6Q=
9797
github.com/go-sourcemap/sourcemap v2.1.4+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg=
98-
github.com/go-viper/mapstructure/v2 v2.2.1 h1:ZAaOCxANMuZx5RCeg0mBdEZk7DZasvvZIxtHqx8aGss=
99-
github.com/go-viper/mapstructure/v2 v2.2.1/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM=
10098
github.com/gocarina/gocsv v0.0.0-20240520201108-78e41c74b4b1 h1:FWNFq4fM1wPfcK40yHE5UO3RUdSNPaBC+j3PokzA6OQ=
10199
github.com/gocarina/gocsv v0.0.0-20240520201108-78e41c74b4b1/go.mod h1:5YoVOkjYAQumqlV356Hj3xeYh4BdZuLE0/nRkf2NKkI=
102100
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=

pkg/net/manager.go

+9
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,15 @@ type NetworkManager struct {
5353
nc *nats.Conn
5454
}
5555

56+
var DefaultManager *NetworkManager
57+
58+
func GetManager() *NetworkManager {
59+
if DefaultManager == nil {
60+
DefaultManager = NewManager()
61+
}
62+
return DefaultManager
63+
}
64+
5665
func NewManager() *NetworkManager {
5766
log.Debug().Msg("net.NewManager")
5867
return &NetworkManager{}

pkg/sim/manager.go

+9
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,15 @@ import (
1212
"github.com/rs/zerolog/log"
1313
)
1414

15+
var DefaultManager *Manager
16+
17+
func GetManager() *Manager {
18+
if DefaultManager == nil {
19+
DefaultManager = NewManager()
20+
}
21+
return DefaultManager
22+
}
23+
1524
type ManagerOptions struct {
1625
NatsUrl string
1726
}

0 commit comments

Comments
 (0)