Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Golang example to consume Confluent Kafka does not contain the go.mod and the build does not work #1122

Open
rogerioefonseca opened this issue Aug 11, 2022 · 0 comments

Comments

@rogerioefonseca
Copy link

Description
I tried to go through the step by step mentioned in the documentation:
https://docs.confluent.io/platform/current/tutorials/examples/clients/docs/go.html?ajs_aid=7077fcce-0d54-4277-a0c0-50c875f49cd2&ajs_uid=718849

While trying to execute it the error message was triggered:
image

I realized that there is no go.mod in the project, and the import of "./ccloud" is breaking. (Honestly could be an ignorance on my side, I do not know how to use those relative imports)
Then I needed to first create a module with go mod init anything/r and go mod tidy

Troubleshooting
Change That I needed to do in the code to make it work

//Change That I needed to do in the code
import (
	"anything/r/ccloud"
	"encoding/json"
	"fmt"
	"gopkg.in/confluentinc/confluent-kafka-go.v1/kafka"
	"os"
	"os/signal"
	"syscall"
	"time"
)

Then after that, I was able to use the example successfully
./producer -f $HOME/.confluent/librdkafka.config -t test1

Environment

  • GitHub branch: 7.2.1-post
  • Operating System: Ubuntu 20.04.3 LTS
  • Version of Docker: Did not use
  • Version of Docker Compose: Did not use
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant