Skip to content

Commit

Permalink
Update Go version to 1.20 (#1187)
Browse files Browse the repository at this point in the history
* Update Go version to 1.20
* Fix deprecation warnings that became errors with go-1.20
  • Loading branch information
timburks authored Jun 9, 2023
1 parent 074c047 commit 74de29d
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 19 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.18
go-version: "1.20"
cache: true
- run: go install ./...
- run: registry config configurations create local --registry.address='127.0.0.1:8080' --registry.insecure
Expand All @@ -43,7 +43,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.18
go-version: "1.20"
cache: true
- run: go install ./...
- run: registry config configurations create local --registry.address='127.0.0.1:8080' --registry.insecure
Expand All @@ -56,7 +56,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.18
go-version: "1.20"
cache: true
- uses: golangci/golangci-lint-action@v3
with:
Expand All @@ -71,7 +71,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.18
go-version: "1.20"
cache: true
- run: go install ./...
- run: registry config configurations create local --registry.address='127.0.0.1:8080' --registry.insecure
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/nightly-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.18
go-version: "1.20"
cache: true
- run: go install ./...
- run: registry config configurations create local --registry.address='127.0.0.1:8080' --registry.insecure
Expand Down Expand Up @@ -55,7 +55,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.18
go-version: "1.20"
cache: true
- run: go install ./...
- run: registry config configurations create local --registry.address='127.0.0.1:8080' --registry.insecure
Expand Down Expand Up @@ -104,7 +104,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.18
go-version: "1.20"
cache: true
- run: go install ./...
- run: registry config configurations create local --registry.address='127.0.0.1:8080' --registry.insecure
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
echo ::set-output name=version::${GITHUB_REF#refs/tags/}
- uses: actions/setup-go@v3
with:
go-version: ^1.18
go-version: "^1.20"
cache: false
- uses: goreleaser/goreleaser-action@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ The entry point for the Registry API server itself is

The following tools are needed to build this software:

- Go 1.18 (recommended) or later.
- Go 1.20 (recommended) or later.
- protoc, the Protocol Buffer Compiler (see
[tools/PROTOC-VERSION.sh](/tools/PROTOC-VERSION.sh) for the currently-used
version).
Expand Down
2 changes: 1 addition & 1 deletion containers/registry-server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# Use the official Golang image to create a build artifact.
# This is based on Debian and sets the GOPATH to /go.
# https://hub.docker.com/_/golang
FROM golang:1.18 as builder
FROM golang:1.20 as builder
RUN apt-get update
RUN apt-get -y install unzip

Expand Down
2 changes: 1 addition & 1 deletion containers/registry-tools/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# Use the official Golang image to create a build artifact.
# This is based on Debian and sets the GOPATH to /go.
# https://hub.docker.com/_/golang
FROM golang:1.18 as builder
FROM golang:1.20 as builder
RUN apt-get update
RUN apt-get install unzip

Expand Down
2 changes: 1 addition & 1 deletion deployments/envoy/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

ARG ENVOY_VERSION=v1.20-latest
ARG GO_VERSION=1.18
ARG GO_VERSION=1.20

FROM golang:${GO_VERSION} as builder

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/apigee/registry

go 1.18
go 1.20

require (
cloud.google.com/go/longrunning v0.4.1
Expand Down
7 changes: 3 additions & 4 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"os"
"path/filepath"
"strings"
Expand Down Expand Up @@ -69,7 +68,7 @@ func CreateFlagSet() *pflag.FlagSet {

// Configurations returns stored Configurations by name
func Configurations() (map[string]Configuration, error) {
files, err := ioutil.ReadDir(Directory)
files, err := os.ReadDir(Directory)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -150,7 +149,7 @@ func Activate(name string) error {
}

f := filepath.Join(Directory, ActivePointerFilename)
return ioutil.WriteFile(f, []byte(name), os.FileMode(0644)) // rw,r,r
return os.WriteFile(f, []byte(name), os.FileMode(0644)) // rw,r,r
}

// ReadValid reads the specified Configuration, resolves it, and
Expand Down Expand Up @@ -253,7 +252,7 @@ func Delete(name string) error {
// Returns "" if active_config is not found.
func ActiveName() (string, error) {
f := filepath.Join(Directory, ActivePointerFilename)
bytes, err := ioutil.ReadFile(f)
bytes, err := os.ReadFile(f)
if errors.Is(err, os.ErrNotExist) {
return "", nil
} else if err != nil {
Expand Down
3 changes: 1 addition & 2 deletions pkg/config/configuration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
package config_test

import (
"io/ioutil"
"os"
"path"
"path/filepath"
Expand Down Expand Up @@ -49,7 +48,7 @@ func TestActiveSettings(t *testing.T) {

// missing config file
f := filepath.Join(config.Directory, config.ActivePointerFilename)
err = ioutil.WriteFile(f, []byte("missing"), os.FileMode(0644)) // rw,r,r
err = os.WriteFile(f, []byte("missing"), os.FileMode(0644)) // rw,r,r
if err != nil {
t.Fatal(err)
}
Expand Down

0 comments on commit 74de29d

Please sign in to comment.