Skip to content

undefined: otel.Meter or cannot find package "go.opentelemetry.io/otel/api/trace" #1534

@vmihailenco

Description

@vmihailenco

To fix cannot find package "go.opentelemetry.io/otel/api/trace" or undefined: otel.Meter:

  1. Make sure to initialize a Go module: go mod init github.com/my/repo

  2. Make sure to use correct import path with v8 in the end: go get github.com/go-redis/redis/v8

For example:

mkdir /tmp/redis-test
cd /tmp/redis-test
go mod init redis-test
go get github.com/go-redis/redis/v8

The root cause

The error is not caused by OpenTelemetry. OpenTelemetry is just the first module Go tries to install. And the error will not go away until you start using Go modules properly.

The presence of $GOROOT or $GOPATH in error messages indicates that you are NOT using Go modules.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions