Skip to content

Commit

Permalink
Update go version to 1.17 (#546)
Browse files Browse the repository at this point in the history
* go mod tidy -go=1.17

* update supported go versions to 1.17 and 1.18

* upgrade go version in workflows and docs

* fix actions

* update docker builder image go version

* remove go 1.6 specific backward compatibility handling

* if cert is updated first time, store it

* avoid race conditions in initial cert update
  • Loading branch information
Samu Tamminen committed Mar 22, 2022
1 parent 8b8191d commit 3f1c559
Show file tree
Hide file tree
Showing 11 changed files with 228 additions and 51 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/code.analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ on:
- "go.sum"
- ".github/workflows/code.analysis.yml"

env:
GO_VERSION: 1.17

jobs:

analysis:
Expand All @@ -19,7 +22,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16
go-version: ${{ env.GO_VERSION }}

- name: Check out code into the Go module directory
uses: actions/checkout@v2
Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
tags:
- "v*"

env:
GO_VERSION: 1.17

permissions:
contents: write

Expand All @@ -19,7 +22,7 @@ jobs:
- name: Set up Go 1.x.y
uses: actions/setup-go@v2
with:
go-version: ^1.16.5
go-version: ${{ env.GO_VERSION }}

- name: Checkout codebase
uses: actions/checkout@v2
Expand All @@ -36,7 +39,7 @@ jobs:
- name: Set up Go 1.x.y
uses: actions/setup-go@v2
with:
go-version: ^1.16.5
go-version: ${{ env.GO_VERSION }}

- name: Checkout codebase
uses: actions/checkout@v2
Expand All @@ -55,7 +58,7 @@ jobs:
- name: Set up Go 1.x.y
uses: actions/setup-go@v2
with:
go-version: ^1.16.5
go-version: ${{ env.GO_VERSION }}

- name: Checkout codebase
uses: actions/checkout@v2
Expand All @@ -72,7 +75,7 @@ jobs:
fetch-depth: 0
- uses: actions/setup-go@v2
with:
go-version: 1.16
go-version: ${{ env.GO_VERSION }}
- uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ on:
- "go.sum"
- ".github/workflows/test.yml"

env:
GO_VERSION: 1.17

jobs:
test:
runs-on: ${{ matrix.os }}
Expand All @@ -32,7 +35,7 @@ jobs:
- name: Set up Go 1.x.y
uses: actions/setup-go@v2
with:
go-version: ^1.16.5
go-version: ${{ env.GO_VERSION }}

- name: Checkout codebase
uses: actions/checkout@v2
Expand All @@ -54,7 +57,7 @@ jobs:
- name: Set up Go 1.x.y
uses: actions/setup-go@v2
with:
go-version: ^1.16.5
go-version: ${{ env.GO_VERSION }}

- name: Checkout codebase
uses: actions/checkout@v2
Expand All @@ -73,7 +76,7 @@ jobs:
- name: Set up Go 1.x.y
uses: actions/setup-go@v2
with:
go-version: ^1.16.5
go-version: ${{ env.GO_VERSION }}

- name: Checkout codebase
uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ build_docker:
docker run -w /egsrc -u ${shell id -u}:${shell id -g} --rm \
-v ${GO_PATH}:/gopath -v ${MKFILE_DIR}:/egsrc -v ${MKFILE_DIR}build/cache:/gocache \
-e GOPROXY=https://goproxy.io,direct -e GOCACHE=/gocache -e GOPATH=/gopath \
megaease/golang:1.17-alpine make build DOCKER=true
megaease/golang:1.18-alpine make build DOCKER=true
docker build -t ${IMAGE_NAME}:${RELEASE} -f ./build/package/Dockerfile .
docker tag ${IMAGE_NAME}:${RELEASE} ${IMAGE_NAME}:latest
docker tag ${IMAGE_NAME}:latest ${IMAGE_NAME}:server-sidecar
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ make

> **Note**:
>
> - This repo requires Go 1.16+ compiler for the build.
> - This repo requires Go 1.17+ compiler for the build.
> - If you need the WebAssembly feature, please run `make wasm`.
Then we can add the binary directory to the `PATH` and execute the server:
Expand Down
2 changes: 1 addition & 1 deletion README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ make

> **注意事项**
>
> - 我们需要 Go 1.16 以上版本的编译器
> - 我们需要 Go 1.17 以上版本的编译器
> - 如果需要支持 WebAssembbly 的版本,你需要运行 `make wasm`
然后把二进制所在目录添加到 `PATH` 中,并启动服务:
Expand Down
4 changes: 2 additions & 2 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ Supported [Go versions](https://go.dev/dl/):

| Version | Supported |
| ------- | ------------------ |
| 1.18.x | :white_check_mark: |
| 1.17.x | :white_check_mark: |
| 1.16.x | :white_check_mark: |
| < 1.16 | :x: |
| < 1.17 | :x: |

# Reporting a Vulnerability

Expand Down
2 changes: 1 addition & 1 deletion build/package/Dockerfile.builder
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
FROM golang:1.17-alpine
FROM golang:1.18-alpine
RUN apk --no-cache add make git
195 changes: 189 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
module github.com/megaease/easegress

go 1.16
go 1.17

require (
github.com/ArthurHlt/go-eureka-client v1.1.0
github.com/Shopify/sarama v1.32.0
github.com/alecthomas/jsonschema v0.0.0-20210526225647-edb03dcab7bc
github.com/bytecodealliance/wasmtime-go v0.33.1
github.com/eclipse/paho.mqtt.golang v1.3.5
github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c // indirect
github.com/facebookgo/freeport v0.0.0-20150612182905-d4adf43b75b9 // indirect
github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 // indirect
github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4 // indirect
github.com/fatih/color v1.13.0
github.com/fsnotify/fsnotify v1.5.1
github.com/ghodss/yaml v1.0.0
Expand Down Expand Up @@ -56,7 +52,6 @@ require (
github.com/tidwall/gjson v1.14.0
github.com/tomasen/realip v0.0.0-20180522021738-f0c99a92ddce
github.com/valyala/fasttemplate v1.2.1
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
github.com/xeipuuv/gojsonschema v1.2.1-0.20201027075954-b076d39a02e5
github.com/yl2chen/cidranger v1.0.2
go.etcd.io/etcd/api/v3 v3.5.2
Expand All @@ -75,6 +70,194 @@ require (
knative.dev/serving v0.29.0
)

require (
contrib.go.opencensus.io/exporter/ocagent v0.7.1-0.20200907061046-05415f1de66d // indirect
contrib.go.opencensus.io/exporter/prometheus v0.4.0 // indirect
github.com/Azure/azure-sdk-for-go v61.2.0+incompatible // indirect
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
github.com/Azure/go-autorest/autorest v0.11.24 // indirect
github.com/Azure/go-autorest/autorest/adal v0.9.18 // indirect
github.com/Azure/go-autorest/autorest/azure/auth v0.5.11 // indirect
github.com/Azure/go-autorest/autorest/azure/cli v0.4.5 // indirect
github.com/Azure/go-autorest/autorest/date v0.3.0 // indirect
github.com/Azure/go-autorest/autorest/to v0.4.0 // indirect
github.com/Azure/go-autorest/logger v0.2.1 // indirect
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
github.com/GehirnInc/crypt v0.0.0-20200316065508-bb7000b8a962 // indirect
github.com/PuerkitoBio/purell v1.1.1 // indirect
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
github.com/aliyun/alibaba-cloud-sdk-go v1.61.18 // indirect
github.com/antlr/antlr4/runtime/Go/antlr v0.0.0-20211221011931-643d94fcab96 // indirect
github.com/armon/go-metrics v0.3.10 // indirect
github.com/aws/aws-sdk-go v1.41.14 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/blendle/zapdriver v1.3.1 // indirect
github.com/buger/jsonparser v1.1.1 // indirect
github.com/census-instrumentation/opencensus-proto v0.3.0 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/cheekybits/genny v1.0.0 // indirect
github.com/cloudevents/sdk-go/sql/v2 v2.8.0 // indirect
github.com/cloudevents/sdk-go/v2 v2.8.0 // indirect
github.com/coreos/go-semver v0.3.0 // indirect
github.com/coreos/go-systemd/v22 v22.3.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/digitalocean/godo v1.41.0 // indirect
github.com/dimchansky/utfbom v1.1.1 // indirect
github.com/dustin/go-humanize v1.0.0 // indirect
github.com/eapache/go-resiliency v1.2.0 // indirect
github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21 // indirect
github.com/eapache/queue v1.1.0 // indirect
github.com/evanphx/json-patch v4.12.0+incompatible // indirect
github.com/evanphx/json-patch/v5 v5.6.0 // indirect
github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c // indirect
github.com/facebookgo/freeport v0.0.0-20150612182905-d4adf43b75b9 // indirect
github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 // indirect
github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4 // indirect
github.com/form3tech-oss/jwt-go v3.2.5+incompatible // indirect
github.com/go-errors/errors v1.0.1 // indirect
github.com/go-kit/log v0.1.0 // indirect
github.com/go-logfmt/logfmt v0.5.0 // indirect
github.com/go-logr/logr v1.2.2 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.19.5 // indirect
github.com/go-openapi/swag v0.19.15 // indirect
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-jwt/jwt/v4 v4.2.0 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/btree v1.0.1 // indirect
github.com/google/go-cmp v0.5.7 // indirect
github.com/google/go-containerregistry v0.8.1-0.20220120151853-ac864e57b117 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/googleapis/gnostic v0.5.5 // indirect
github.com/gregjones/httpcache v0.0.0-20190212212710-3befbb6ad0cc // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect
github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-hclog v1.0.0 // indirect
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
github.com/hashicorp/go-retryablehttp v0.7.0 // indirect
github.com/hashicorp/go-rootcerts v1.0.2 // indirect
github.com/hashicorp/go-uuid v1.0.2 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/hashicorp/serf v0.9.6 // indirect
github.com/iancoleman/orderedmap v0.0.0-20190318233801-ac98e3ecb4b0 // indirect
github.com/imdario/mergo v0.3.12 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/jcmturner/aescts/v2 v2.0.0 // indirect
github.com/jcmturner/dnsutils/v2 v2.0.0 // indirect
github.com/jcmturner/gofork v1.0.0 // indirect
github.com/jcmturner/gokrb5/v8 v8.4.2 // indirect
github.com/jcmturner/rpc/v2 v2.0.3 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/jonboulle/clockwork v0.2.2 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/kelseyhightower/envconfig v1.4.0 // indirect
github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de // indirect
github.com/magiconair/properties v1.8.5 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/marten-seemann/qpack v0.2.1 // indirect
github.com/marten-seemann/qtls-go1-16 v0.1.4 // indirect
github.com/marten-seemann/qtls-go1-17 v0.1.0 // indirect
github.com/marten-seemann/qtls-go1-18 v0.1.0-beta.1 // indirect
github.com/mattn/go-colorable v0.1.12 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
github.com/miekg/dns v1.1.41 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect
github.com/nrdcg/dnspod-go v0.4.0 // indirect
github.com/nxadm/tail v1.4.8 // indirect
github.com/onsi/ginkgo v1.16.5 // indirect
github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492 // indirect
github.com/pelletier/go-toml v1.9.4 // indirect
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
github.com/pierrec/lz4 v2.6.1+incompatible // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v1.11.0 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.32.1 // indirect
github.com/prometheus/procfs v0.6.0 // indirect
github.com/prometheus/statsd_exporter v0.21.0 // indirect
github.com/rickb777/date v1.13.0 // indirect
github.com/rickb777/plural v1.2.1 // indirect
github.com/robfig/cron/v3 v3.0.1 // indirect
github.com/sirupsen/logrus v1.8.1 // indirect
github.com/soheilhy/cmux v0.1.5 // indirect
github.com/spf13/afero v1.8.0 // indirect
github.com/spf13/cast v1.4.1 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/subosito/gotenv v1.2.0 // indirect
github.com/tidwall/match v1.1.1 // indirect
github.com/tidwall/pretty v1.2.0 // indirect
github.com/tmc/grpc-websocket-proxy v0.0.0-20201229170055-e5319fda7802 // indirect
github.com/toolkits/concurrent v0.0.0-20150624120057-a4371d70e3e3 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/vultr/govultr/v2 v2.11.0 // indirect
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 // indirect
github.com/xlab/treeprint v0.0.0-20181112141820-a009c3971eca // indirect
go.etcd.io/bbolt v1.3.6 // indirect
go.etcd.io/etcd/client/pkg/v3 v3.5.2 // indirect
go.etcd.io/etcd/client/v2 v2.305.2 // indirect
go.etcd.io/etcd/pkg/v3 v3.5.2 // indirect
go.etcd.io/etcd/raft/v3 v3.5.2 // indirect
go.opencensus.io v0.23.0 // indirect
go.opentelemetry.io/contrib v0.20.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.20.0 // indirect
go.opentelemetry.io/otel v0.20.0 // indirect
go.opentelemetry.io/otel/exporters/otlp v0.20.0 // indirect
go.opentelemetry.io/otel/metric v0.20.0 // indirect
go.opentelemetry.io/otel/sdk v0.20.0 // indirect
go.opentelemetry.io/otel/sdk/export/metric v0.20.0 // indirect
go.opentelemetry.io/otel/sdk/metric v0.20.0 // indirect
go.opentelemetry.io/otel/trace v0.20.0 // indirect
go.opentelemetry.io/proto/otlp v0.7.0 // indirect
go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5 // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
golang.org/x/mod v0.5.1 // indirect
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 // indirect
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11 // indirect
golang.org/x/tools v0.1.8 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect
google.golang.org/api v0.63.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa // indirect
google.golang.org/grpc v1.43.0 // indirect
google.golang.org/protobuf v1.27.1 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/ini.v1 v1.66.2 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
gotest.tools/v3 v3.0.3 // indirect
k8s.io/apiextensions-apiserver v0.22.5 // indirect
k8s.io/cli-runtime v0.22.5 // indirect
k8s.io/klog/v2 v2.40.1 // indirect
k8s.io/kube-openapi v0.0.0-20211115234752-e816edb12b65 // indirect
k8s.io/utils v0.0.0-20211208161948-7d6a63dca704 // indirect
knative.dev/eventing v0.29.0 // indirect
knative.dev/networking v0.0.0-20220120043934-ec785540a732 // indirect
knative.dev/pkg v0.0.0-20220118160532-77555ea48cd4 // indirect
sigs.k8s.io/kustomize/api v0.8.11 // indirect
sigs.k8s.io/kustomize/kyaml v0.11.0 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.1.2 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
)

replace github.com/go-openapi/spec => github.com/go-openapi/spec v0.19.3

replace github.com/buger/jsonparser => github.com/buger/jsonparser v1.1.1
11 changes: 2 additions & 9 deletions pkg/object/autocertmanager/autocertmanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,16 +253,9 @@ func (acm *AutoCertManager) Close() {
acm.cancel()
// TODO: remove this after converting AutoCertManager to system controller.
//
// globalACM equals acm means the AutoCertManager is being deleted, so we
// globalACM equals nil means the AutoCertManager is being deleted, so we
// need to set the globalACM to nil.
//
// But note here's a race condition, the value of globalACM may no longer be
// 'acm' when we call globalACM.Store. Fixing the issue requires
// atomic.Value.CompareAndSwap, please refer the comment for Domain.UpdateCert
// for details.
if globalACM.Load() == acm {
globalACM.Store((*AutoCertManager)(nil))
}
globalACM.CompareAndSwap(acm, (*AutoCertManager)(nil))
}

func (acm *AutoCertManager) renew() bool {
Expand Down
Loading

0 comments on commit 3f1c559

Please sign in to comment.