From d6ef60a09e8a7a8f4e4fa264d124151297ac1fd1 Mon Sep 17 00:00:00 2001 From: Mike Goldsmth Date: Fri, 7 Jan 2022 16:23:56 +0000 Subject: [PATCH 1/6] update go version in circleci workflows --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 3993193..9b5a7b5 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -8,7 +8,7 @@ executors: parameters: goversion: type: string - default: "12" + default: "17" working_directory: /go/src/github.com/honeycombio/dynsampler-go docker: - image: circleci/golang:1.<< parameters.goversion >> @@ -27,7 +27,7 @@ jobs: parameters: goversion: type: string - default: "12" + default: "17" executor: name: go goversion: "<< parameters.goversion >>" From 95a1e7ce5373824a373d3bfe966130c8961fd17c Mon Sep 17 00:00:00 2001 From: Robb Kidd Date: Fri, 7 Jan 2022 14:58:58 -0500 Subject: [PATCH 2/6] matrixify the versions of Go to test Let's see which work! --- .circleci/config.yml | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 9b5a7b5..8ae4066 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -49,14 +49,8 @@ workflows: requires: - setup - test_dynsampler: - goversion: "10" - requires: - - setup - - test_dynsampler: - goversion: "11" - requires: - - setup - - test_dynsampler: - goversion: "12" requires: - setup + matrix: + parameters: + goversion: ["10", "11", "12", "13", "14", "15", "16", "17"] From bffaa16cc021bf669e42a14644aa855f248ec32e Mon Sep 17 00:00:00 2001 From: Robb Kidd Date: Fri, 7 Jan 2022 16:04:10 -0500 Subject: [PATCH 3/6] drop Go 1.10 and 1.11 CircleCi doesn't have a cimg/go for 1.10 and 1.11's is unhappy running sudo to get updated cacerts. They're old. We should stop testing against them. Updated to matrixify like we do in libhoney-go. --- .circleci/config.yml | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 8ae4066..acad0e6 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -3,15 +3,23 @@ version: 2.1 orbs: buildevents: honeycombio/buildevents@0.2.3 +matrix_goversions: &matrix_goversions + matrix: + parameters: + goversion: ["12", "13", "14", "15", "16", "17"] + +# Default version of Go to use for Go steps +default_goversion: &default_goversion "17" + executors: go: parameters: goversion: type: string - default: "17" - working_directory: /go/src/github.com/honeycombio/dynsampler-go + default: *default_goversion + working_directory: /home/circleci/go/src/github.com/honeycombio/dynsampler-go docker: - - image: circleci/golang:1.<< parameters.goversion >> + - image: cimg/go:1.<< parameters.goversion >> jobs: setup: @@ -27,13 +35,20 @@ jobs: parameters: goversion: type: string - default: "17" + default: *default_goversion executor: name: go goversion: "<< parameters.goversion >>" steps: - buildevents/with_job_span: steps: + - when: + condition: + equal: ["12", "<< parameters.goversion >>" ] + steps: + - run: + name: Update certs in old CI image + command: sudo apt-get update && sudo apt-get install -y ca-certificates - checkout - run: go get -v -t -d ./... - run: go test -race -v ./... @@ -49,8 +64,6 @@ workflows: requires: - setup - test_dynsampler: + <<: *matrix_goversions requires: - setup - matrix: - parameters: - goversion: ["10", "11", "12", "13", "14", "15", "16", "17"] From 5a204b3be6ec5c5e4e6b2f59facdc816838be0ed Mon Sep 17 00:00:00 2001 From: Robb Kidd Date: Fri, 7 Jan 2022 16:06:28 -0500 Subject: [PATCH 4/6] go mod, go! Targeted Go 1.12 to work our way up to something modern. --- .circleci/config.yml | 2 ++ go.mod | 5 +++++ go.sum | 11 +++++++++++ 3 files changed, 18 insertions(+) create mode 100644 go.mod create mode 100644 go.sum diff --git a/.circleci/config.yml b/.circleci/config.yml index acad0e6..f1dc210 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -20,6 +20,8 @@ executors: working_directory: /home/circleci/go/src/github.com/honeycombio/dynsampler-go docker: - image: cimg/go:1.<< parameters.goversion >> + environment: + GO111MODULE: "on" jobs: setup: diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..498ed66 --- /dev/null +++ b/go.mod @@ -0,0 +1,5 @@ +module github.com/honeycombio/dynsampler-go + +go 1.12 + +require github.com/stretchr/testify v1.6.1 diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..afe7890 --- /dev/null +++ b/go.sum @@ -0,0 +1,11 @@ +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= From 22ade914c7aea35b438e763a49c39d6b7b7cfe8d Mon Sep 17 00:00:00 2001 From: Robb Kidd Date: Fri, 7 Jan 2022 16:18:28 -0500 Subject: [PATCH 5/6] just call these "test" We know it's dynsampler already. Also, the workflow isn't really building anything; it only runs the tests across multiple Go versions. --- .circleci/config.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f1dc210..3ffc018 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -33,7 +33,7 @@ jobs: steps: - buildevents/watch_build_and_finish - test_dynsampler: + test: parameters: goversion: type: string @@ -59,13 +59,13 @@ jobs: field_value: << parameters.goversion >> workflows: - build_dynsampler: + test: jobs: - setup - watch: requires: - setup - - test_dynsampler: + - test: <<: *matrix_goversions requires: - setup From 6928b8ed3169131ff6202d6303bc4ec84b8bdb56 Mon Sep 17 00:00:00 2001 From: Robb Kidd Date: Fri, 7 Jan 2022 17:29:44 -0500 Subject: [PATCH 6/6] maybe don't need to set the working directory? --- .circleci/config.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 3ffc018..d455603 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -17,7 +17,6 @@ executors: goversion: type: string default: *default_goversion - working_directory: /home/circleci/go/src/github.com/honeycombio/dynsampler-go docker: - image: cimg/go:1.<< parameters.goversion >> environment: