소스 검색

Only show port name if set.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
(cherry picked from commit 909c596fa5956ed02b4708a437a828a2829c9bd5)
Signed-off-by: Tibor Vass <tibor@docker.com>
Daniel Nephin 9 년 전
부모
커밋
cf2b19a72e
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      api/client/service/inspect.go

+ 1 - 1
api/client/service/inspect.go

@@ -141,7 +141,7 @@ func printService(out io.Writer, service swarm.Service) {
 	if len(service.Endpoint.Ports) > 0 {
 		fmt.Fprintln(out, "Ports:")
 		for _, port := range service.Endpoint.Ports {
-			fmt.Fprintf(out, " Name = %s\n", port.Name)
+			ioutils.FprintfIfNotEmpty(out, " Name = %s\n", port.Name)
 			fmt.Fprintf(out, " Protocol = %s\n", port.Protocol)
 			fmt.Fprintf(out, " TargetPort = %d\n", port.TargetPort)
 			fmt.Fprintf(out, " PublishedPort = %d\n", port.PublishedPort)