소스 검색

replace label & goto with a method

Work around the const/label conflict bug in go16beta1 by replacing a
label & goto with a method.

https://github.com/golang/go/issues/13684
Ben Burkert 10 년 전
부모
커밋
29d4b91ea5
1개의 변경된 파일4개의 추가작업 그리고 2개의 파일을 삭제
  1. 4 2
      async_producer.go

+ 4 - 2
async_producer.go

@@ -581,7 +581,8 @@ func (bp *brokerProducer) run() {
 		select {
 		case msg := <-bp.input:
 			if msg == nil {
-				goto shutdown
+				bp.shutdown()
+				return
 			}
 
 			if msg.flags&syn == syn {
@@ -637,8 +638,9 @@ func (bp *brokerProducer) run() {
 			output = nil
 		}
 	}
+}
 
-shutdown:
+func (bp *brokerProducer) shutdown() {
 	for !bp.buffer.empty() {
 		select {
 		case response := <-bp.responses: