Skip to content

Instantly share code, notes, and snippets.

@hodbn

hodbn/go.mod Secret

Last active September 9, 2021 07:52
Show Gist options
  • Save hodbn/5b8fe5242a5e46e1c635108a21ffe869 to your computer and use it in GitHub Desktop.
Save hodbn/5b8fe5242a5e46e1c635108a21ffe869 to your computer and use it in GitHub Desktop.
AMQPlain repro
module github.com/hodbn/gist
go 1.16
require github.com/streadway/amqp v1.0.0
package main
import (
"log"
"os"
"time"
amqplib "github.com/streadway/amqp"
)
func main() {
var conn *amqplib.Connection
c := amqplib.Config{
Heartbeat: 10 * time.Second,
Locale: "en_US",
}
c.SASL = []amqplib.Authentication{&amqplib.AMQPlainAuth{
Username: os.Args[1],
Password: os.Args[2],
}}
conn, err := amqplib.DialConfig(os.Args[3], c)
if err != nil {
log.Printf("can't dial: %v", err)
} else {
log.Println("works")
}
conn.Close()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment