feat(GODT-2631): Bump go to 1.20.

This commit is contained in:
Jakub Cuth
2023-05-23 13:37:12 +00:00
parent ebe45d5abe
commit aa72fd641d
4 changed files with 9 additions and 14 deletions

View File

@ -16,7 +16,7 @@
# along with ProtonMail Bridge. If not, see <https://www.gnu.org/licenses/>. # along with ProtonMail Bridge. If not, see <https://www.gnu.org/licenses/>.
--- ---
image: harbor.protontech.ch/docker.io/library/golang:1.18 image: gitlab.protontech.ch:4567/go/bridge-internal:test-go1.20
variables: variables:
GOPRIVATE: gitlab.protontech.ch GOPRIVATE: gitlab.protontech.ch
@ -126,10 +126,10 @@ test-integration-race:
.windows-base: .windows-base:
before_script: before_script:
- export GOROOT=/c/Go1.18 - export GOROOT=/c/Go1.20
- export PATH=$GOROOT/bin:$PATH - export PATH=$GOROOT/bin:$PATH
- export GOARCH=amd64 - export GOARCH=amd64
- export GOPATH=~/go18 - export GOPATH=~/go1.20
- export GO111MODULE=on - export GO111MODULE=on
- export PATH=$GOPATH/bin:$PATH - export PATH=$GOPATH/bin:$PATH
- export MSYSTEM= - export MSYSTEM=
@ -172,7 +172,7 @@ test-windows:
.linux-build-setup: .linux-build-setup:
image: gitlab.protontech.ch:4567/go/bridge-internal:qt6 image: gitlab.protontech.ch:4567/go/bridge-internal:build-go1.20-qt6.3.2
variables: variables:
VCPKG_DEFAULT_BINARY_CACHE: ${CI_PROJECT_DIR}/.cache VCPKG_DEFAULT_BINARY_CACHE: ${CI_PROJECT_DIR}/.cache
cache: cache:
@ -209,7 +209,7 @@ build-linux-qa:
- export PATH=/usr/local/opt/make/libexec/gnubin:$PATH - export PATH=/usr/local/opt/make/libexec/gnubin:$PATH
- export PATH=/usr/local/opt/go@1.13/bin:$PATH - export PATH=/usr/local/opt/go@1.13/bin:$PATH
- export PATH=/usr/local/opt/gnu-sed/libexec/gnubin:$PATH - export PATH=/usr/local/opt/gnu-sed/libexec/gnubin:$PATH
- export GOPATH=~/go - export GOPATH=~/go1.20
- export PATH=$GOPATH/bin:$PATH - export PATH=$GOPATH/bin:$PATH
- export CGO_CPPFLAGS='-Wno-error -Wno-nullability-completeness -Wno-expansion-to-defined -Wno-builtin-requires-header' - export CGO_CPPFLAGS='-Wno-error -Wno-nullability-completeness -Wno-expansion-to-defined -Wno-builtin-requires-header'
- $(git config --global -l | grep -o 'url.*gitlab.protontech.ch.*insteadof' | xargs -L 1 git config --global --unset &> /dev/null) || echo "nothing to remove" - $(git config --global -l | grep -o 'url.*gitlab.protontech.ch.*insteadof' | xargs -L 1 git config --global --unset &> /dev/null) || echo "nothing to remove"
@ -231,10 +231,10 @@ build-darwin-qa:
.windows-build-setup: .windows-build-setup:
before_script: before_script:
- export GOROOT=/c/Go1.18/ - export GOROOT=/c/Go1.20/
- export PATH=$GOROOT/bin:$PATH - export PATH=$GOROOT/bin:$PATH
- export GOARCH=amd64 - export GOARCH=amd64
- export GOPATH=~/go18 - export GOPATH=~/go1.20
- export GO111MODULE=on - export GO111MODULE=on
- export PATH="${GOPATH}/bin:${PATH}" - export PATH="${GOPATH}/bin:${PATH}"
- export MSYSTEM= - export MSYSTEM=

View File

@ -3,7 +3,7 @@
## Prerequisites ## Prerequisites
* 64-bit OS: * 64-bit OS:
- the go-rfc5322 module cannot currently be compiled for 32-bit OSes - the go-rfc5322 module cannot currently be compiled for 32-bit OSes
* Go 1.18 * Go 1.20
* Bash with basic build utils: make, gcc, sed, find, grep, ... * Bash with basic build utils: make, gcc, sed, find, grep, ...
- For Windows, it is recommended to use MinGW 64bit shell from [MSYS2](https://www.msys2.org/) - For Windows, it is recommended to use MinGW 64bit shell from [MSYS2](https://www.msys2.org/)
* GCC (Linux), msvc (Windows) or Xcode (macOS) * GCC (Linux), msvc (Windows) or Xcode (macOS)

2
go.mod
View File

@ -1,6 +1,6 @@
module github.com/ProtonMail/proton-bridge/v3 module github.com/ProtonMail/proton-bridge/v3
go 1.18 go 1.20
require ( require (
github.com/0xAX/notificator v0.0.0-20220220101646-ee9b8921e557 github.com/0xAX/notificator v0.0.0-20220220101646-ee9b8921e557

View File

@ -19,14 +19,12 @@ package app
import ( import (
"fmt" "fmt"
"math/rand"
"net/http" "net/http"
"net/http/cookiejar" "net/http/cookiejar"
"net/url" "net/url"
"os" "os"
"path/filepath" "path/filepath"
"runtime" "runtime"
"time"
"github.com/Masterminds/semver/v3" "github.com/Masterminds/semver/v3"
"github.com/ProtonMail/gluon/async" "github.com/ProtonMail/gluon/async"
@ -160,9 +158,6 @@ func New() *cli.App {
} }
func run(c *cli.Context) error { func run(c *cli.Context) error {
// Seed the default RNG from the math/rand package.
rand.Seed(time.Now().UnixNano())
// Get the current bridge version. // Get the current bridge version.
version, err := semver.NewVersion(constants.Version) version, err := semver.NewVersion(constants.Version)
if err != nil { if err != nil {