Skip to content

Commit

Permalink
Bump dependencies and remove unnecessary external dependency for exam…
Browse files Browse the repository at this point in the history
…ple. (#212)

- bumps some library dependencies to resolve some CVE's.
- removes external dependency in example code
- makes some linters a bit happier
- bumps testing matrix to more modern Go compilers versions: 1.17, 1.18, 1.19
  • Loading branch information
basvanbeek authored Oct 11, 2022
1 parent f916476 commit a58f3b6
Show file tree
Hide file tree
Showing 14 changed files with 207 additions and 287 deletions.
11 changes: 0 additions & 11 deletions .circleci/config.yml

This file was deleted.

6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ jobs:
go: ["1.17"]
include:
- os: ubuntu-latest
go: "1.14"
go: "1.17"
- os: ubuntu-latest
go: "1.15"
go: "1.18"
- os: ubuntu-latest
go: "1.16"
go: "1.19"
steps:
# Set fetch-depth: 0 to fetch commit history and tags for use in version calculation
- name: Check out code
Expand Down
10 changes: 0 additions & 10 deletions examples/go.mod

This file was deleted.

94 changes: 0 additions & 94 deletions examples/go.sum

This file was deleted.

29 changes: 16 additions & 13 deletions examples/httpserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@ import (
"os"
"time"

"github.com/gorilla/mux"

zipkin "github.com/openzipkin/zipkin-go"
"github.com/openzipkin/zipkin-go"
zipkinhttp "github.com/openzipkin/zipkin-go/middleware/http"
logreporter "github.com/openzipkin/zipkin-go/reporter/log"
)

func Example() {
// set up a span reporter
reporter := logreporter.NewReporter(log.New(os.Stderr, "", log.LstdFlags))
defer reporter.Close()
defer func() {
_ = reporter.Close()
}()

// create our local service endpoint
endpoint, err := zipkin.NewEndpoint("myService", "localhost:0")
Expand All @@ -57,27 +57,29 @@ func Example() {
}

// initialize router
router := mux.NewRouter()
router := http.NewServeMux()

// start web service with zipkin http server middleware
ts := httptest.NewServer(serverMiddleware(router))
defer ts.Close()

// set-up handlers
router.Methods("GET").Path("/some_function").HandlerFunc(someFunc(client, ts.URL))
router.Methods("POST").Path("/other_function").HandlerFunc(otherFunc(client))
router.HandleFunc("/some_function", someFunc(client, ts.URL))
router.HandleFunc("/other_function", otherFunc(client))

// initiate a call to some_func
req, err := http.NewRequest("GET", ts.URL+"/some_function", nil)
var req *http.Request
req, err = http.NewRequest("GET", ts.URL+"/some_function", nil)
if err != nil {
log.Fatalf("unable to create http request: %+v\n", err)
}

res, err := client.DoWithAppSpan(req, "some_function")
var res *http.Response
res, err = client.DoWithAppSpan(req, "some_function")
if err != nil {
log.Fatalf("unable to do http request: %+v\n", err)
}
res.Body.Close()
_ = res.Body.Close()

// Output:
}
Expand Down Expand Up @@ -105,17 +107,18 @@ func someFunc(client *zipkinhttp.Client, url string) http.HandlerFunc {

newRequest = newRequest.WithContext(ctx)

res, err := client.DoWithAppSpan(newRequest, "other_function")
var res *http.Response
res, err = client.DoWithAppSpan(newRequest, "other_function")
if err != nil {
log.Printf("call to other_function returned error: %+v\n", err)
http.Error(w, err.Error(), 500)
return
}
res.Body.Close()
_ = res.Body.Close()
}
}

func otherFunc(client *zipkinhttp.Client) http.HandlerFunc {
func otherFunc(_ *zipkinhttp.Client) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
log.Printf("other_function called with method: %s\n", r.Method)
time.Sleep(50 * time.Millisecond)
Expand Down
42 changes: 37 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,12 +1,44 @@
module github.com/openzipkin/zipkin-go

require (
github.com/Shopify/sarama v1.30.0
github.com/Shopify/sarama v1.37.2
github.com/onsi/ginkgo v1.16.5
github.com/onsi/gomega v1.16.0
github.com/rabbitmq/amqp091-go v1.1.0
google.golang.org/grpc v1.41.0
google.golang.org/protobuf v1.27.1
github.com/rabbitmq/amqp091-go v1.5.0
google.golang.org/grpc v1.50.0
google.golang.org/protobuf v1.28.1
)

go 1.14
require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/eapache/go-resiliency v1.3.0 // indirect
github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21 // indirect
github.com/eapache/queue v1.1.0 // indirect
github.com/fsnotify/fsnotify v1.4.9 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/go-cmp v0.5.8 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-uuid v1.0.3 // indirect
github.com/jcmturner/aescts/v2 v2.0.0 // indirect
github.com/jcmturner/dnsutils/v2 v2.0.0 // indirect
github.com/jcmturner/gofork v1.7.6 // indirect
github.com/jcmturner/gokrb5/v8 v8.4.3 // indirect
github.com/jcmturner/rpc/v2 v2.0.3 // indirect
github.com/klauspost/compress v1.15.11 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/nxadm/tail v1.4.8 // indirect
github.com/pierrec/lz4/v4 v4.1.17 // indirect
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
github.com/rogpeppe/go-internal v1.9.0 // indirect
golang.org/x/crypto v0.0.0-20221010152910-d6f0a8c073c2 // indirect
golang.org/x/net v0.0.0-20221004154528-8021a29435af // indirect
golang.org/x/sys v0.0.0-20221010170243-090e33056c14 // indirect
golang.org/x/text v0.3.8 // indirect
google.golang.org/genproto v0.0.0-20221010155953-15ba04fc1c0e // indirect
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
)

go 1.18
Loading

0 comments on commit a58f3b6

Please sign in to comment.