diff options
author | Pavlo Strokov <pstrokov@gitlab.com> | 2020-04-02 21:44:02 +0300 |
---|---|---|
committer | Pavlo Strokov <pstrokov@gitlab.com> | 2020-04-02 21:44:02 +0300 |
commit | 8a561867be7b08443babcf8223b9671312e47031 (patch) | |
tree | 040e40ceab573df2e807e1781fe3ca5c2983ae8b | |
parent | 587e71c346823048a0a01d562a57682001c2566a (diff) | |
parent | f61c92f033b7bd0ba14d14397e7ce2594d9c1f5e (diff) |
Merge branch 'zj-drop-go-1.12-support' into 'master'
Drop go 1.12 support
See merge request gitlab-org/gitaly!1976
-rw-r--r-- | .gitlab-ci.yml | 20 | ||||
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | changelogs/unreleased/zj-drop-go-1-12-support.yml | 5 | ||||
-rw-r--r-- | go.mod | 2 | ||||
-rw-r--r-- | internal/praefect/protoregistry/find_oid.go | 45 | ||||
-rw-r--r-- | proto/README.md | 2 |
6 files changed, 12 insertions, 64 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 119e4334e..d4d185620 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -103,10 +103,6 @@ build:go1.13: <<: *build_definition image: registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6-golang-1.13-git-2.22 -build:go1.12: - <<: *build_definition - image: registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6-golang-1.12-git-2.21 - binaries_go1.14: <<: *assemble_definition image: registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6-golang-1.14-git-2.24 @@ -115,12 +111,8 @@ binaries_go1.13: <<: *assemble_definition image: registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6-golang-1.13-git-2.22 -binaries_go1.12: - <<: *assemble_definition - image: registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6-golang-1.12-git-2.21 - -test:go1.14-git-2.21-ruby-2.6: - image: registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6-golang-1.13-git-2.24 +test:go1.14-git-2.24-ruby-2.6: + image: registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6-golang-1.14-git-2.24 <<: *test_definition test:go1.13-git-2.21-ruby-2.6: @@ -131,18 +123,10 @@ test:go1.13-git-2.22-ruby-2.6: image: registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6-golang-1.13-git-2.22 <<: *test_definition -test:go1.12-git-2.22-ruby-2.6: - image: registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6-golang-1.12-git-2.22 - <<: *test_definition - test:go1.13-git-2.24-ruby-2.6: image: registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6-golang-1.13-git-2.24 <<: *test_definition -test:go1.12-git-2.24-ruby-2.6: - image: registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6-golang-1.12-git-2.24 - <<: *test_definition - test:proxy: <<: *test_definition script: @@ -54,7 +54,7 @@ GitLab.com, read about our [observibiltiy story](doc/observibility.md)! Most users won't install Gitaly on its own. It is already included in [your GitLab installation](https://about.gitlab.com/install/). -Gitaly requires Go 1.12.13 or newer and Ruby 2.6. Run `make` to download +Gitaly requires Go 1.13.9 or newer and Ruby 2.6. Run `make` to download and compile Ruby dependencies, and to compile the Gitaly Go executable. diff --git a/changelogs/unreleased/zj-drop-go-1-12-support.yml b/changelogs/unreleased/zj-drop-go-1-12-support.yml new file mode 100644 index 000000000..c6d1cff1b --- /dev/null +++ b/changelogs/unreleased/zj-drop-go-1-12-support.yml @@ -0,0 +1,5 @@ +--- +title: Drop go 1.12 support +merge_request: 1976 +author: +type: removed @@ -24,4 +24,4 @@ require ( gopkg.in/yaml.v2 v2.2.8 ) -go 1.12 +go 1.13 diff --git a/internal/praefect/protoregistry/find_oid.go b/internal/praefect/protoregistry/find_oid.go index 7d8691fe3..5a110c93c 100644 --- a/internal/praefect/protoregistry/find_oid.go +++ b/internal/praefect/protoregistry/find_oid.go @@ -3,7 +3,6 @@ package protoregistry import ( "errors" "fmt" - "math" "reflect" "regexp" "strconv" @@ -81,48 +80,8 @@ const ( protobufTagRegexFieldGroup = 2 ) -// TODO: This code is copied from the go standard library's reflect package in go 1.13. Once we deprecate support -// for go 1.12, we need to remove this code and call value.isZero directly -func isZero(v reflect.Value) bool { - switch v.Kind() { - case reflect.Bool: - return !v.Bool() - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - return v.Int() == 0 - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - return v.Uint() == 0 - case reflect.Float32, reflect.Float64: - return math.Float64bits(v.Float()) == 0 - case reflect.Complex64, reflect.Complex128: - c := v.Complex() - return math.Float64bits(real(c)) == 0 && math.Float64bits(imag(c)) == 0 - case reflect.Array: - for i := 0; i < v.Len(); i++ { - if !isZero(v.Index(i)) { - return false - } - } - return true - case reflect.Chan, reflect.Func, reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice, reflect.UnsafePointer: - return v.IsNil() - case reflect.String: - return v.Len() == 0 - case reflect.Struct: - for i := 0; i < v.NumField(); i++ { - if !isZero(v.Field(i)) { - return false - } - } - return true - default: - // This should never happens, but will act as a safeguard for - // later, as a default value doesn't makes sense here. - panic(&reflect.ValueError{"reflect.Value.IsZero", v.Kind()}) - } -} - func findProtoField(msgV reflect.Value, protoField int) (reflect.Value, error) { - if isZero(msgV) { + if msgV.IsZero() { return reflect.Value{}, ErrProtoFieldEmpty } @@ -166,7 +125,7 @@ func tryNumberedField(field reflect.StructField, protoField int) (bool, error) { } func tryOneOfField(msgV reflect.Value, field reflect.StructField, protoField int) (reflect.Value, bool) { - if isZero(msgV) { + if msgV.IsZero() { return reflect.Value{}, false } diff --git a/proto/README.md b/proto/README.md index 479ca920e..9a38d20db 100644 --- a/proto/README.md +++ b/proto/README.md @@ -281,7 +281,7 @@ files but not the client libraries. This check uses `git diff` to look for changes. Some of the code in the Go client libraries is sensitive to implementation details of the Go standard library (specifically, the output of gzip). **Use the same Go version as .gitlab-ci.yml (Go -1.12)** when generating new client libraries for a merge request. +1.13)** when generating new client libraries for a merge request. [DCO + License](CONTRIBUTING.md) |