Skip to content

Commit

Permalink
Bump minimum go version for YDBGo from 1.13 to 1.18 (needed by stretc…
Browse files Browse the repository at this point in the history
…hr/testify/assert package)

Background
----------
* Below is pasted from stretchr/testify#1379 (comment)
  where I had asked a question on a recent failure we saw in the YDBGo pipelines (and in
  the YDBTest/go/unit_test subtest failures in in-house systems which had go 1.13 and 1.15).

  @HaraldNordgren : Hi. We have a Go application that uses the `stretchry/testify` package. It was
  working fine on various systems with different go versions. But for the past 4 days, our nightly
  pipelines have been failing when run with go 1.13.8.

  ```sh
  $ go version
  go version go1.13.8 linux/amd64
  ```

  The failure symptom is the following (pasted from https://gitlab.com/YottaDB/Lang/YDBGo/-/jobs/4268493955)

  ```sh
  $ go test -short $(go list ./... | grep -v /vendor/)
  # github.com/stretchr/testify/assert
  /go/src/github.com/stretchr/testify/assert/assertions.go:94:23: field.IsExported undefined (type reflect.StructField has no field or method IsExported)
  ```

  The same application also fails on a system with `go version go1.15.15 linux/amd64` but passes on a
  system with `go version go1.18.1 linux/amd64`.

  4c93d8f changed `assertions.go` to add the `field.isExported` call. But looks like that call is only
  supported by recent versions of go.

  Is this seeming regression expected? Thanks.

* And below was the response (pasted from stretchr/testify#1379 (comment))

  In general I would definitely advise against using the 'master' build of any library. You are better
  off pinning the version to testify@v1.8.2 and you would avoid this issue.

  This repo has been updated to only support Go versions >=1.18.

  Be aware the the Go versions you are using are not officially supported anymore:
  https://endoflife.date/go. It would also be a good idea to upgrade your Go versions.

Fix
---
* I tried pinning the version like was suggested. I tried updating go.mod as follows.

  ```diff
  $ git diff go.mod
  @@ -4,2 +4,3 @@ go 1.13

  -require github.com/stretchr/testify v1.4.0
  +require github.com/stretchr/testify v1.8.2
  +replace github.com/stretchr/testify => github.com/stretchr/testify v1.8.2
  ```

  But the YDBGo pipeline still failed as before when it used go 1.13 or go 1.15.

* I then tried the following change.

  ```diff
  $ git diff go.mod
  @@ -4,2 +4,3 @@ go 1.13

  -require github.com/stretchr/testify v1.8.2
  +require github.com/stretchr/testify v1.4.0
  +replace github.com/stretchr/testify => github.com/stretchr/testify v1.8.2
  ```

  This one failed the same way as well.

* Finally decided to bump the go version required by the pipeline to 1.18 as suggested above.
  Searched for all references of `1.13` in the YDBGo repository in the `develop` branch and
  changed all of them to be `1.18`. In some cases, used `1.18.10` as that was the latest
  golang version in the 1.18 series.

  And regenerated `go.mod` using the following steps. This auto-generated go.mod file is
  included in this commit.

  ```sh
  $ cd YDBGo
  $ echo "module lang.yottadb.com/go/yottadb" > go.mod
  $ go get -t
  go: added github.com/davecgh/go-spew v1.1.1
  go: added github.com/pmezard/go-difflib v1.0.0
  go: added github.com/stretchr/testify v1.8.2
  go: added gopkg.in/yaml.v3 v3.0.1
  ```

* And in the in-house systems that have go 1.13 (Ubuntu 20.04) and go 1.15 (Debian 11), decided
  to install the latest Go version using snap instead of using the old go version from the package
  manager. The install worked fine on x86_64, AARCH64 and ARM32 architectures. With those changes,
  the `go/unit_tests` subtest passes fine on all those architectures when it previously reliably failed.
  • Loading branch information
nars1 committed May 17, 2023
1 parent 7810e3a commit 9af51d7
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 39 deletions.
39 changes: 8 additions & 31 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,9 @@ stages:
variables:
# Note: If GOLANG_VERSION below is bumped up in the future, changes would be needed to at least the following files
# YDBGo repo : Dockerfile
# YDBOcto repo : .gitlab-ci.yml
# YDBOcto repo : Dockerfile-Tests
# YDBOcto repo : Dockerfile-Tests.centos
# There might be more files to change in the future.
# Search for "GOLANG_VERSION" name in all YDB repos to find places that need change.
GOLANG_VERSION: 1.13.8
GOLANG_VERSION: 1.18.1

before_script:
- apt-get update && apt-get install -y --no-install-recommends wget ca-certificates git g++ gcc libc6-dev make pkg-config && rm -rf /var/lib/apt/lists/*
Expand Down Expand Up @@ -64,40 +61,20 @@ before_script:
#
# In general, test the latest point release of each major version
#
unit_tests1.13.8_tests:
unit_tests1.18.10:
extends: .unit_tests
variables:
GOLANG_VERSION: "1.13.8"
GOLANG_VERSION: "1.18.10"

unit_tests1.14.13_tests:
unit_tests1.19.9:
extends: .unit_tests
variables:
GOLANG_VERSION: "1.14.13"
GOLANG_VERSION: "1.19.9"

unit_tests1.15.15_tests:
unit_tests1.20.4:
extends: .unit_tests
variables:
GOLANG_VERSION: "1.15.15"

unit_tests1.16.15:
extends: .unit_tests
variables:
GOLANG_VERSION: "1.16.15"

unit_tests1.17.13:
extends: .unit_tests
variables:
GOLANG_VERSION: "1.17.13"

unit_tests1.18.9:
extends: .unit_tests
variables:
GOLANG_VERSION: "1.18.9"

unit_tests1.19.4:
extends: .unit_tests
variables:
GOLANG_VERSION: "1.19.4"
GOLANG_VERSION: "1.20.4"

race_detector:
stage: test
Expand Down Expand Up @@ -137,7 +114,7 @@ commit-verify:
lint_code:
stage: test
variables:
GOLANG_VERSION: "1.18.9"
GOLANG_VERSION: "1.18.10"
script:
- go get -u golang.org/x/lint/golint
- find / -name "*lint*"
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ RUN apt-get update && \
# Install go
ENV GOPATH /go
RUN mkdir /go
ENV GOLANG_VERSION 1.13.8
ENV GOLANG_VERSION 1.18.1
ENV PATH=$GOPATH/bin:/usr/local/go/bin:$PATH
RUN wget -O go.tgz -q https://golang.org/dl/go${GOLANG_VERSION}.linux-amd64.tar.gz && \
tar -C /usr/local -xzf go.tgz && \
Expand Down
4 changes: 2 additions & 2 deletions doc.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//////////////////////////////////////////////////////////////////
// //
// Copyright (c) 2018-2022 YottaDB LLC and/or its subsidiaries. //
// Copyright (c) 2018-2023 YottaDB LLC and/or its subsidiaries. //
// All rights reserved. //
// //
// This source code contains the intellectual property //
Expand All @@ -18,7 +18,7 @@ YottaDB Quick Start
Before starting, consider reading the introduction to YottaDB's data model at https://docs.yottadb.com/MultiLangProgGuide/MultiLangProgGuide.html#concepts
The YottaDB Go wrapper requires a minimum YottaDB version of r1.34 and
is tested with a minimum Go version of 1.13. If the Go packages on
is tested with a minimum Go version of 1.18. If the Go packages on
your operating system are older, and the Go wrapper does not work,
please obtain and install a newer Go implementation.
Expand Down
10 changes: 8 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
module lang.yottadb.com/go/yottadb

go 1.13
go 1.18

require github.com/stretchr/testify v1.4.0
require github.com/stretchr/testify v1.8.2

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
6 changes: 3 additions & 3 deletions yottadb.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//////////////////////////////////////////////////////////////////
// //
// Copyright (c) 2018-2022 YottaDB LLC and/or its subsidiaries. //
// Copyright (c) 2018-2023 YottaDB LLC and/or its subsidiaries. //
// All rights reserved. //
// //
// This source code contains the intellectual property //
Expand All @@ -12,7 +12,7 @@

// This package is a Go wrapper for a YottaDB database using the SimplaAPI interface. While the functional part
// of this package runs OK with Go 1.10, certain external packages are used by the internal unit tests invoked
// by 'go test' that have been updated to use facilities only present in Go 1.13.0 and later.
// by 'go test' that have been updated to use facilities only present in Go 1.18.0 and later.
//
// This wrapper makes significant use of the 'cgo' facility to interface between this Go wrapper and the YottaDB
// engine written in C. The cgo facility is described here: https://golang.org/cmd/cgo - Note that cgo imposes
Expand Down Expand Up @@ -80,7 +80,7 @@ const MinimumYDBReleaseMinor int = 34
const MinimumYDBRelease string = "r1.34"

// MinimumGoRelease - (string) Minimum version of Go to fully support this wrapper (including tests)
const MinimumGoRelease string = "go1.13"
const MinimumGoRelease string = "go1.18"

// YDBHandlerFlag type is the flag type passed to yottadb.RegisterSignalNotify() to indicate when or if the driver should run the
// YottaDB signal handler.
Expand Down

0 comments on commit 9af51d7

Please sign in to comment.