Skip to content

Commit

Permalink
fix (eclipse-paho#661): Add NewClientOptionsReader for mocking purposes.
Browse files Browse the repository at this point in the history
  • Loading branch information
avmunm committed Dec 19, 2023
1 parent 5786441 commit cd0031e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/eclipse/paho.mqtt.golang
module github.com/avmunm/paho.mqtt.golang

go 1.20

Expand Down
7 changes: 7 additions & 0 deletions options_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ type ClientOptionsReader struct {
options *ClientOptions
}

// NewOptionsReader creates a ClientOptionsReader, this should only be used for mocking purposes.
func NewOptionsReader(o *ClientOptions) ClientOptionsReader {
return ClientOptionsReader{
options: o,
}
}

// Servers returns a slice of the servers defined in the clientoptions
func (r *ClientOptionsReader) Servers() []*url.URL {
s := make([]*url.URL, len(r.options.Servers))
Expand Down

0 comments on commit cd0031e

Please sign in to comment.