census-instrumentation / opencensus-website

opencensus.io website content
https://opencensus.io
Apache License 2.0
42 stars 155 forks source link

sample code: Fix import package name #716

Closed budougumi0617 closed 5 years ago

budougumi0617 commented 5 years ago

I appreciate easy-to-understand documents.

Go language differentiates the case in package PATH. the correct opencensus-go-exporter-datadog repository PATH on GitHub is below.

https://github.com/DataDog/opencensus-go-exporter-datadog

But, it import path in sample codes is below:

https://opencensus.io/exporters/supported-exporters/go/datadog/

package main

import (
  "log"

  "github.com/Datadog/opencensus-go-exporter-datadog"
  "go.opencensus.io/stats/view"
)

func main() {
  dd, err := datadog.NewExporter(datadog.Options{})
  if err != nil {
    log.Fatalf("Failed to create the Datadog exporter: %v", err)
  }
  // It is imperative to invoke flush before your main function exits
  defer dd.Stop()

  // Register it as a metrics exporter
  view.RegisterExporter(dd)
}

Data"d"og is not correct, the correct path is Data"D"og.

using Go1.13, go.mod(dependency file) is below:

module github.com/budougumi0617/til/go/datadog/opencensus

go 1.13

require (
        github.com/DataDog/datadog-go v2.2.0+incompatible // indirect
        github.com/Datadog/opencensus-go-exporter-datadog v0.0.0-20190926132405-fe3fae706db1
        github.com/philhofer/fwd v1.0.0 // indirect
        github.com/stretchr/testify v1.4.0 // indirect
        github.com/tinylib/msgp v1.1.0 // indirect
        go.opencensus.io v0.22.1
        gopkg.in/DataDog/dd-trace-go.v1 v1.18.0 // indirect
)

I think it should be unified to the correct import path.

Regards,