Update formatting for mistake #11

This commit is contained in:
Slawomir Dolzycki-Uchto 2025-01-17 13:23:10 +01:00 committed by GitHub
parent 8e08283bee
commit 9bc9149ef9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -229,10 +229,10 @@ type Option func(options *options) error
func WithPort(port int) Option {
return func(options *options) error {
if port < 0 {
return errors.New("port should be positive")
}
options.port = &port
return nil
return errors.New("port should be positive")
}
options.port = &port
return nil
}
}
@ -251,7 +251,7 @@ func NewServer(addr string, opts ...Option) ( *http.Server, error) {
if options.port == nil {
port = defaultHTTPPort
} else {
if *options.port == 0 {
if *options.port == 0 {
port = randomPort()
} else {
port = *options.port