weather/internal/web/address.go

26 lines
424 B
Go

package web
import "fmt"
//ListenAddr host port listen information
type ListenAddr interface {
String() string
}
type listenAddr struct {
Addr string
Port int
}
//NewListenAddr create new instance of ListenAddr
func NewListenAddr(addr string, port int) ListenAddr {
return listenAddr{
Addr: addr,
Port: port,
}
}
func (l listenAddr) String() string {
return fmt.Sprintf("%s:%s", l.Addr, fmt.Sprint(l.Port))
}