Skip to content

Commit

Permalink
Update to Go 1.20 (#3429)
Browse files Browse the repository at this point in the history
* Go 1.20 changes

* go 1.20 does not need the seed randomised by default

* go generate
  • Loading branch information
hawkowl authored Mar 5, 2024
1 parent 172741b commit ed94c28
Show file tree
Hide file tree
Showing 25 changed files with 34 additions and 46 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci-go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
ci-from-docker:
runs-on: ubuntu-latest
container:
image: registry.access.redhat.com/ubi8/go-toolset:1.18.10
image: registry.access.redhat.com/ubi8/go-toolset:1.20.10
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand All @@ -38,13 +38,13 @@ jobs:
uses: actions/checkout@v4
- run: |
go mod vendor
go mod tidy -compat=1.18
go mod tidy -compat=1.20
hack/ci-utils/isClean.sh
generate-check:
runs-on: ubuntu-latest
container:
image: registry.access.redhat.com/ubi8/go-toolset:1.18.10
image: registry.access.redhat.com/ubi8/go-toolset:1.20.10
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ run:
- "containers_image_openpgp"
- "exclude_graphdriver_devicemapper"
- "exclude_graphdriver_btrfs"
go: "1.18"
go: "1.20"

output:
format: github-actions
Expand Down
2 changes: 1 addition & 1 deletion .pipelines/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pr:
resources:
containers:
- container: golang
image: registry.access.redhat.com/ubi8/go-toolset:1.18.10
image: registry.access.redhat.com/ubi8/go-toolset:1.20.10
options: --user=0
- container: python
image: registry.access.redhat.com/ubi8/python-39:latest
Expand Down
2 changes: 1 addition & 1 deletion .pipelines/clean-subscription.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ parameters:
resources:
containers:
- container: golang
image: registry.access.redhat.com/ubi8/go-toolset:1.18
image: registry.access.redhat.com/ubi8/go-toolset:1.20
options: --user=0

variables:
Expand Down
2 changes: 1 addition & 1 deletion .pipelines/onebranch/pipeline.buildrp.official.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pr: none
variables:
Cdp_Definition_Build_Count: $[counter('', 0)] # needed for onebranch.pipeline.version task https://aka.ms/obpipelines/versioning
ONEBRANCH_AME_ACR_LOGIN: cdpxb8e9ef87cd634085ab141c637806568c00.azurecr.io
LinuxContainerImage: $(ONEBRANCH_AME_ACR_LOGIN)/b8e9ef87-cd63-4085-ab14-1c637806568c/official/ubi8/go-toolset:1.18.4 # Docker image which is used to build the project https://aka.ms/obpipelines/containers
LinuxContainerImage: $(ONEBRANCH_AME_ACR_LOGIN)/b8e9ef87-cd63-4085-ab14-1c637806568c/official/ubi8/go-toolset:1.20.10 # Docker image which is used to build the project https://aka.ms/obpipelines/containers
Debian_Frontend: noninteractive

resources:
Expand Down
2 changes: 1 addition & 1 deletion .pipelines/onebranch/pipeline.buildrp.pullrequest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pr: none
variables:
Cdp_Definition_Build_Count: $[counter('', 0)] # needed for onebranch.pipeline.version task https://aka.ms/obpipelines/versioning
ONEBRANCH_AME_ACR_LOGIN: cdpxb8e9ef87cd634085ab141c637806568c00.azurecr.io
LinuxContainerImage: $(ONEBRANCH_AME_ACR_LOGIN)/b8e9ef87-cd63-4085-ab14-1c637806568c/official/ubi8/go-toolset:1.18.4 # Docker image which is used to build the project https://aka.ms/obpipelines/containers
LinuxContainerImage: $(ONEBRANCH_AME_ACR_LOGIN)/b8e9ef87-cd63-4085-ab14-1c637806568c/official/ubi8/go-toolset:1.20.10 # Docker image which is used to build the project https://aka.ms/obpipelines/containers
Debian_Frontend: noninteractive

resources:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.aro-e2e
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Uses a multi-stage container build to build the RP & E2E components.
#
ARG REGISTRY
FROM ${REGISTRY}/ubi8/go-toolset:1.18.10 AS builder
FROM ${REGISTRY}/ubi8/go-toolset:1.20.10 AS builder

USER root
ENV GOPATH=/root/go
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.aro-multistage
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Uses a multi-stage container build to build the RP.
#
ARG REGISTRY
FROM ${REGISTRY}/ubi8/go-toolset:1.18.10 AS builder
FROM ${REGISTRY}/ubi8/go-toolset:1.20.10 AS builder

USER root
ENV GOPATH=/root/go
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile.gatekeeper
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG REGISTRY
FROM ${REGISTRY}/ubi8/go-toolset:1.18.10-1 AS builder
FROM ${REGISTRY}/ubi8/go-toolset:1.20.10-1 AS builder
ARG GATEKEEPER_VERSION
ENV DOWNLOAD_URL=https://github.com/open-policy-agent/gatekeeper/archive/${GATEKEEPER_VERSION}.tar.gz

Expand Down Expand Up @@ -29,4 +29,4 @@ ENTRYPOINT ["/manager"]

USER ${USER_UID}
LABEL io.openshift.managed.name="guardrails-operator" \
io.openshift.managed.description="Operator to enforce guardrails policies for Openshift version 4 clusters"
io.openshift.managed.description="Operator to enforce guardrails policies for Openshift version 4 clusters"
2 changes: 1 addition & 1 deletion Dockerfile.proxy
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Uses a multi-stage container build to build the proxy
#
ARG REGISTRY
FROM ${REGISTRY}/ubi8/go-toolset:1.18.10 AS builder
FROM ${REGISTRY}/ubi8/go-toolset:1.20.10 AS builder
USER root
ENV GOPATH=/root/go
RUN mkdir -p /app
Expand Down
4 changes: 0 additions & 4 deletions cmd/aro/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@ import (
"context"
"flag"
"fmt"
"math/rand"
"net/http"
_ "net/http/pprof"
"os"
"strings"
"time"

"github.com/Azure/ARO-RP/pkg/env"
utillog "github.com/Azure/ARO-RP/pkg/util/log"
Expand All @@ -35,8 +33,6 @@ func usage() {
}

func main() {
rand.Seed(time.Now().UnixNano())

flag.Usage = usage
flag.Parse()

Expand Down
2 changes: 1 addition & 1 deletion docs/prepare-a-shared-rp-development-environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ locations.
PULL_SECRET=...
```

1. Install [Go 1.18](https://golang.org/dl) or later, if you haven't already.
1. Install [Go 1.20](https://golang.org/dl) or later, if you haven't already.
1. Install the [Azure
CLI](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli), if you
Expand Down
2 changes: 1 addition & 1 deletion docs/prepare-your-dev-environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This document goes through the development dependencies one requires in order to

## Software Required

1. Install [Go 1.18](https://golang.org/dl) or later, if you haven't already.
1. Install [Go 1.20](https://golang.org/dl) or later, if you haven't already.
1. After downloading follow the [Install instructions](https://go.dev/doc/install), replacing the tar archive with your download.
1. Append `export PATH="${PATH}:/usr/local/go/bin"` to your shell's profile file.

Expand Down
4 changes: 2 additions & 2 deletions docs/updating-dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ The reason for calling script instead of directly calling:

```bash
go get -u ./...
go mod tidy -compat=1.18
go mod tidy -compat=1.20
go mod vendor
```

Expand All @@ -43,7 +43,7 @@ the PR, one can simply call
go get <module>@<release> OR
go get -u <module>@<release>

go mod tidy -compat=1.18
go mod tidy -compat=1.20
go mod vendor
```

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/Azure/ARO-RP

go 1.18
go 1.20

require (
github.com/Azure/azure-sdk-for-go v63.1.0+incompatible
Expand Down
4 changes: 0 additions & 4 deletions hack/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ package main
import (
"context"
"fmt"
"math/rand"
"os"
"strings"
"time"

"github.com/davecgh/go-spew/spew"
"github.com/sirupsen/logrus"
Expand Down Expand Up @@ -71,8 +69,6 @@ func run(ctx context.Context, log *logrus.Entry) error {
func main() {
log := utillog.GetLogger()

rand.Seed(time.Now().UnixNano())

if err := run(context.Background(), log); err != nil {
if oDataError, ok := err.(msgraph_errors.ODataErrorable); ok {
spew.Dump(oDataError.GetErrorEscaped())
Expand Down
2 changes: 1 addition & 1 deletion hack/update-go-module-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,5 @@ done

go get -u ./...

go mod tidy -compat=1.18
go mod tidy -compat=1.20
go mod vendor
1 change: 0 additions & 1 deletion pkg/api/admin/zz_generated_installphase_enumer.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion pkg/api/zz_generated_installphase_enumer.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/containerinstall/install_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
testlog "github.com/Azure/ARO-RP/test/util/log"
)

const TEST_PULLSPEC = "registry.access.redhat.com/ubi8/go-toolset:1.18.10"
const TEST_PULLSPEC = "registry.access.redhat.com/ubi8/go-toolset:1.20.10"

var _ = Describe("Podman", Ordered, func() {
var err error
Expand Down
1 change: 0 additions & 1 deletion pkg/env/zz_generated_feature_enumer.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 7 additions & 5 deletions pkg/operator/controllers/rbac/bindata.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 7 additions & 5 deletions pkg/portal/cluster/bindata.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion pkg/util/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,6 @@ func (c *Cluster) generateSubnets() (vnetPrefix string, masterSubnet string, wor
// 10.1.0.0/24 is used by rp-vnet to host Proxy VM
// 10.2.0.0/24 is used by dev-vpn-vnet to host VirtualNetworkGateway
var x, y int
rand.Seed(time.Now().UnixNano())
// Local Dev clusters are limited to /16 dev-vnet
if !c.ci {
x, y = 0, 2*rand.Intn(128)
Expand Down
4 changes: 0 additions & 4 deletions test/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ package e2e

import (
"flag"
"math/rand"
"testing"
"time"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
Expand All @@ -23,8 +21,6 @@ import (
)

func TestE2E(t *testing.T) {
rand.Seed(time.Now().UnixNano())

flag.Parse()
logrus.SetOutput(GinkgoWriter)
log = utillog.GetLogger()
Expand Down

0 comments on commit ed94c28

Please sign in to comment.