Skip to content

Commit

Permalink
save service port as integer
Browse files Browse the repository at this point in the history
Only convert it when requested via Service interface's Address
function. That way, we simplify the construction of the ServiceListen
structure in the future.
  • Loading branch information
mpolednik committed Nov 29, 2017
1 parent a701358 commit 4b0288d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,17 @@ type Service interface {
type ServiceListen struct {
Name string
Host string
Port string
Port int
}

func NewServiceListen(name string, host *string, port *int) *ServiceListen {
return &ServiceListen{
Name: name,
Host: host,
Port: strconv.Itoa(port),
Host: *host,
Port: *port,
}
}

func (service *ServiceListen) Address() string {
return fmt.Sprintf("%s:%s", service.Host, service.Port)
return fmt.Sprintf("%s:%s", service.Host, strconv.Itoa(service.Port))
}

0 comments on commit 4b0288d

Please sign in to comment.