Skip to content

Commit

Permalink
Update to Go 1.16.2 (#8989)
Browse files Browse the repository at this point in the history
  • Loading branch information
sspaink authored Mar 16, 2021
1 parent 4e9bc06 commit 89f5e8a
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 56 deletions.
75 changes: 24 additions & 51 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ executors:
go-1_16:
working_directory: '/go/src/github.com/influxdata/telegraf'
docker:
- image: 'quay.io/influxdb/telegraf-ci:1.16.1'
- image: 'quay.io/influxdb/telegraf-ci:1.16.2'
environment:
GOFLAGS: -p=8
mac:
Expand All @@ -37,14 +37,6 @@ commands:
- run: 'GOARCH=<< parameters.goarch >> make check'
- run: 'GOARCH=<< parameters.goarch >> make check-deps'
- run: 'GOARCH=<< parameters.goarch >> make test'
test-go-mac:
steps:
- checkout
- attach_workspace:
at: '/'
- run: 'make'
- run: 'make check'
- run: 'make test'
package:
parameters:
nightly:
Expand Down Expand Up @@ -88,31 +80,6 @@ jobs:
root: '/go'
paths:
- '*'
macdeps:
executor: mac
steps:
- checkout
- restore_cache:
key: mac-go-mod-v3-{{ checksum "go.sum" }}
- run: 'brew update'
- run: 'brew install go@1.16'
- run: 'make deps'
- run: 'make tidy'
- save_cache:
name: 'go module cache'
key: mac-go-mod-v3-{{ checksum "go.sum" }}
paths:
- '~/go/pkg/mod'
- '/usr/local/Cellar/go'
- '/usr/local/bin/go'
- '/usr/local/bin/gofmt'
- persist_to_workspace:
root: '/'
paths:
- 'usr/local/bin/go'
- 'usr/local/Cellar/go'
- 'usr/local/bin/gofmt'
- 'Users/distiller/go'
test-go-1_15:
executor: go-1_15
steps:
Expand All @@ -131,17 +98,32 @@ jobs:
steps:
- test-go:
goarch: "386"
test-go-darwin:
test-go-mac:
executor: mac
steps:
- test-go-mac
- checkout
- restore_cache:
key: mac-go-mod-v0-{{ checksum "go.sum" }}
- run: 'sh ./scripts/mac_installgo.sh'
- save_cache:
name: 'Saving cache'
key: mac-go-mod-v0-{{ checksum "go.sum" }}
paths:
- '/usr/local/Cellar/go'
- '/usr/local/bin/go'
- '/usr/local/bin/gofmt'
- run: 'make deps'
- run: 'make tidy'
- run: 'make'
- run: 'make check'
- run: 'make test'
test-go-windows:
executor:
name: win/default
shell: powershell.exe
steps:
- checkout
- run: choco upgrade golang --version=1.15.8
- run: choco upgrade golang --version=1.16.2
- run: choco install make
- run: git config --system core.longpaths true
- run: make test-windows
Expand Down Expand Up @@ -201,10 +183,6 @@ workflows:
version: 2
check:
jobs:
- 'macdeps':
filters:
tags:
only: /.*/
- 'deps':
filters:
tags:
Expand Down Expand Up @@ -233,9 +211,7 @@ workflows:
filters:
tags:
only: /.*/
- 'test-go-darwin':
requires:
- 'macdeps'
- 'test-go-mac':
filters:
tags: # only runs on tags if you specify this filter
only: /.*/
Expand All @@ -246,15 +222,15 @@ workflows:
- 'package':
requires:
- 'test-go-windows'
- 'test-go-darwin'
- 'test-go-mac'
- 'test-go-1_15'
- 'test-go-1_15-386'
- 'test-go-1_16'
- 'test-go-1_16-386'
- 'release':
requires:
- 'test-go-windows'
- 'test-go-darwin'
- 'test-go-mac'
- 'test-go-1_15'
- 'test-go-1_15-386'
- 'test-go-1_16'
Expand All @@ -279,7 +255,6 @@ workflows:
nightly:
jobs:
- 'deps'
- 'macdeps'
- 'test-go-1_15':
requires:
- 'deps'
Expand All @@ -292,14 +267,12 @@ workflows:
- 'test-go-1_16-386':
requires:
- 'deps'
- 'test-go-darwin':
requires:
- 'macdeps'
- 'test-go-mac'
- 'test-go-windows'
- 'nightly':
requires:
- 'test-go-windows'
- 'test-go-darwin'
- 'test-go-mac'
- 'test-go-1_15'
- 'test-go-1_15-386'
- 'test-go-1_16'
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ ci-1.15:

.PHONY: ci-1.16
ci-1.16:
docker build -t quay.io/influxdb/telegraf-ci:1.16.1 - < scripts/ci-1.16.docker
docker push quay.io/influxdb/telegraf-ci:1.16.1
docker build -t quay.io/influxdb/telegraf-ci:1.16.2 - < scripts/ci-1.16.docker
docker push quay.io/influxdb/telegraf-ci:1.16.2

.PHONY: install
install: $(buildbin)
Expand Down
2 changes: 1 addition & 1 deletion scripts/alpine.docker
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.16.1 as builder
FROM golang:1.16.2 as builder
WORKDIR /go/src/github.com/influxdata/telegraf

COPY . /go/src/github.com/influxdata/telegraf
Expand Down
2 changes: 1 addition & 1 deletion scripts/buster.docker
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.16.1-buster as builder
FROM golang:1.16.2-buster as builder
WORKDIR /go/src/github.com/influxdata/telegraf

COPY . /go/src/github.com/influxdata/telegraf
Expand Down
2 changes: 1 addition & 1 deletion scripts/ci-1.16.docker
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.16.1
FROM golang:1.16.2

RUN chmod -R 755 "$GOPATH"

Expand Down
27 changes: 27 additions & 0 deletions scripts/mac_installgo.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/sh

version="1.16.2"
# This path is cachable, while saving directly in /usr/local/ will cause issues restoring the cache
path="/usr/local/Cellar"

# Download Go directly from tar, the reason we aren't using brew: it is slow to update and we can't pull specific minor versions
setup_go () {
echo "installing go"
curl -OL https://golang.org/dl/go${version}.darwin-amd64.tar.gz --output go${version}.darwin-amd64.tar.gz
sudo rm -rf ${path}/go
sudo tar -C $path -xzf go${version}.darwin-amd64.tar.gz
ln -sf ${path}/go/bin/go /usr/local/bin/go
ln -sf ${path}/go/bin/gofmt /usr/local/bin/gofmt
}

if command -v go &> /dev/null; then
echo "Go is already installed"
v=`go version | { read _ _ v _; echo ${v#go}; }`
echo "$v is installed, required version is $version"
if [ "$v" != $version ]; then
setup_go
go version
fi
else
setup_go
fi

0 comments on commit 89f5e8a

Please sign in to comment.