go-messaging icon indicating copy to clipboard operation
go-messaging copied to clipboard

multiple-value uuid.NewV4() in single-value context

Open shahidammer opened this issue 6 years ago • 3 comments

i am getting this error, here is the error attached /Users//workspace/git/go-messaging/lib lib/tcp_server.go:27:19: multiple-value uuid.NewV4() in single-value context /Users//workspace/git/go-messaging/messages messages/consumer.go:25:30: multiple-value uuid.NewV4() in single-value context

	u1 := uuid.NewV4()

shahidammer avatar Apr 28 '18 06:04 shahidammer

Having the same issue here, even trying to change the UUID to https://github.com/segmentio/ksuid/ or github.com/gofrs/uuid

I am trying to debug it and if I have any meaningful finding, I will post it here.

Cheers.

jralmaraz avatar Jan 15 '19 08:01 jralmaraz

Is clientID being actually used ?

I had a quick look at https://github.com/bsm/sarama-cluster and https://github.com/bsm/sarama-cluster/blob/master/config.go and couldn't find clientID.

I have commented it in messages/consumer.go // config.ClientID = uuid.NewV4()

and in consumerGroupId I have assigned the value without .String(), which I could build at least. I will run a couple of tests to check it out.

    if configuration.ConsumerGroupId==""{

// consumerGroupId = uuid.NewV4().String() consumerGroupId, err := uuid.NewV4() if err != nil { log.Fatalf("failed to generate UUID: %v", err) } log.Printf("generated Version 4 UUID %v", consumerGroupId) } else { consumerGroupId = configuration.ConsumerGroupId }

[2019-01-15 21:40:24,353] INFO [GroupCoordinator 0]: Preparing to rebalance group id-1 in state PreparingRebalance with old generation 1 (__consumer_offsets-49) (reason: Adding new member sarama-c3687af2-6bbe-4d72-b591-c2aa92e97931) (kafka.coordinator.group.GroupCoordinator)

[2019-01-15 21:40:48,117] INFO [GroupCoordinator 0]: Member sarama-0c257479-6c60-49e6-a256-724e2a7b022f in group id-1 has failed, removing it from the group (kafka.coordinator.group.GroupCoordinator)

[2019-01-15 21:40:48,126] INFO [GroupCoordinator 0]: Stabilized group id-1 generation 2 (__consumer_offsets-49) (kafka.coordinator.group.GroupCoordinator) [2019-01-15 21:40:48,136] INFO [GroupCoordinator 0]: Assignment received from leader for group id-1 for generation 2 (kafka.coordinator.group.GroupCoordinator)

Otherwise, the original issue remains on consumer:

jralmaraz@controller:~/go/src/github.com/jralmaraz/goworker-kafka$ go build main.go

_/home/jralmaraz/go/src/github.com/jralmaraz/goworker-kafka/messages

messages/consumer.go:29:30: multiple-value uuid.NewV4() in single-value context jralmaraz@controller:~/go/src/github.com/jralmaraz/goworker-kafka$

jralmaraz avatar Jan 15 '19 08:01 jralmaraz

uuid.NewV4() return two values and here in this code considering only one va;ue which is UUID, and ignoring the error. So to resove the error break the expression into two parts first take the values of uuid which will return two value one is uuid and another is error.

configID, err := uuid.NewV4()
if err != nil {
log.Fatal(err)
}
config.ClientID = configID.String()

I was able to remove the error on multiple value in single- value context.

khanirrfan avatar May 21 '20 03:05 khanirrfan