title: No consumers, yet when I publish something an ack is immediately returned why? (golang/rabbitmq)
body: <p>Below is the publisher code that I use. It requires acks before the message is taken off the queue. It's suppose to print out that it receives an Ack or nack (at the bottom of the code) from a consumer. If you just run the publisher code below by itself (without running a consumer code at same time), it suppose to just hang, waiting for ack or nack but it doesn't, it prints out an ack as if a consumer had sent it. So I'm confused if I have any part of the code wrong.</p>
  
  <p>For the base code I used code from rabbitmq's official tutorial: <a href="https://www.rabbitmq.com/tutorials/tutorial-one-go.html" rel="nofollow noreferrer">https://www.rabbitmq.com/tutorials/tutorial-one-go.html</a></p>
  
  <p>For ack/nack part of the code I followed this: <a href="https://agocs.org/blog/2014/08/19/rabbitmq-best-practices-in-go/" rel="nofollow noreferrer">https://agocs.org/blog/2014/08/19/rabbitmq-best-practices-in-go/</a></p>
  
  <pre><code>package main
  
  import (
      "log"
      "github.com/streadway/amqp"
  )
  
  func failOnError(err error, msg string) {
      if err != nil {
          log.Fatalf("%s: %s", msg, err)
      }
  }
  
  func main() {
  
      conn, err := amqp.Dial("amqp://guest:guest@localhost:5672/")
      failOnError(err, "Failed to connect to RabbitMQ")
      defer conn.Close()
  
      ch, err := conn.Channel()
      failOnError(err, "Failed to open a channel")
      defer ch.Close()
  
       ch.Confirm(false)
  
      ack, nack := ch.NotifyConfirm(make(chan uint64, 1), make(chan uint64, 1))
  
      q, err := ch.QueueDeclare(
          "hello", // name
          false,   // durable
          false,   // delete when unused
          false,   // exclusive
          false,   // no-wait
          nil,     // arguments
      )
      failOnError(err, "Failed to declare a queue")
  
      body := "hello"
      err = ch.Publish(
          "",     // exchange
          q.Name, // routing key
          true,  // mandatory
          false,  // immediate
          amqp.Publishing{
              ContentType: "text/plain",
              Body:        []byte(body),
          })
      log.Printf(" [x] Sent %s", body)
      failOnError(err, "Failed to publish a message")
  
      select {
        case tag := &lt;-ack:
            log.Println("Acked ", tag)
        case tag := &lt;-nack:
            log.Println("Nack alert! ", tag)
      }
  }
  </code></pre>