packagexmpp// Code to generate unique IDs for outgoing messages.import("fmt")varid<-chanstringfuncinit(){// Start the unique id generator.idCh:=make(chanstring)id=idChgofunc(chchan<-string){id:=int64(1)for{str:=fmt.Sprintf("id_%d",id)ch<-strid++}}(idCh)}// This function may be used as a convenient way to generate a unique// id for an outgoing iq, message, or presence stanza.funcNextId()string{return<-id}