Skip to content

Commit

Permalink
Bump Go version from 1.17 to 1.19 (#2894)
Browse files Browse the repository at this point in the history
* Bump Go version from 1.17 to 1.19

* Fix deprecated "io/ioutil"

* go generate ./...

* go generate ./...

* Remove GO111MODULE=on

* Replace go get with go install for building the server
  • Loading branch information
roger2hk committed Jan 20, 2023
1 parent 8039e2c commit 305388e
Show file tree
Hide file tree
Showing 24 changed files with 67 additions and 552 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

## HEAD

* Recommended go version for development: 1.19
* This is the version used by the cloudbuild presubmits. Using a
different version can lead to presubmits failing due to unexpected
diffs.

### Misc

* Bump Go version from 1.17 to 1.19.

## v1.5.1

### Storage
Expand All @@ -10,6 +19,7 @@
with support provided by Equinix Metal.

### Misc

* Fix log server not exiting properly on SIGINT

### Dependency updates
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ The current state of feature implementation is recorded in the

To build and test Trillian you need:

- Go 1.17 or later (go 1.17 matches cloudbuild, and is preferred for developers
- Go 1.19 or later (go 1.19 matches cloudbuild, and is preferred for developers
that will be submitting PRs to this project).

To run many of the tests (and production deployment) you need:
Expand Down Expand Up @@ -193,7 +193,6 @@ go generate -x ./... # hunts for //go:generate comments and runs them
The Trillian codebase uses go.mod to declare fixed versions of its dependencies.
With Go modules, updating a dependency simply involves running `go get`:
```
export GO111MODULE=on
go get package/path # Fetch the latest published version
go get package/path@X.Y.Z # Fetch a specific published version
go get package/path@HEAD # Fetch the latest commit
Expand Down
1 change: 0 additions & 1 deletion cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ options:
- name: go-modules
path: /go
env:
- GO111MODULE=on
- GOPATH=/go
- GOLANG_PROTOBUF_REGISTRATION_CONFLICT=ignore # Temporary work-around v1.proto already registered error.
- DOCKER_CLIENT_TIMEOUT=120
Expand Down
3 changes: 1 addition & 2 deletions cmd/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package cmd
import (
"errors"
"flag"
"io/ioutil"
"os"

"bitbucket.org/creachadair/shell"
Expand Down Expand Up @@ -49,7 +48,7 @@ func parseFlags(file string) error {
// so that flags provided on the command line take precedence over
// flags provided in the file.
func ParseFlagFile(path string) error {
file, err := ioutil.ReadFile(path)
file, err := os.ReadFile(path)
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions crypto/keys/pem/pem.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"encoding/pem"
"errors"
"fmt"
"io/ioutil"
"os"

"github.com/google/trillian/crypto/keys/der"
"github.com/google/trillian/crypto/keyspb"
Expand All @@ -36,7 +36,7 @@ func ReadPrivateKeyFile(file, password string) (crypto.Signer, error) {
return nil, fmt.Errorf("pemfile: empty password for file %q", file)
}

keyPEM, err := ioutil.ReadFile(file)
keyPEM, err := os.ReadFile(file)
if err != nil {
return nil, fmt.Errorf("pemfile: error reading file %q: %v", file, err)
}
Expand Down
3 changes: 2 additions & 1 deletion crypto/keyspb/keyspb.pb.go

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

2 changes: 1 addition & 1 deletion examples/deployment/docker/db_client/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.17-buster
FROM golang:1.19-buster

RUN apt-get update && \
apt-get install -y mariadb-client
Expand Down
5 changes: 2 additions & 3 deletions examples/deployment/docker/log_server/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
FROM golang:1.17-buster as build
FROM golang:1.19-buster as build

WORKDIR /trillian

ARG GOFLAGS=""
ENV GOFLAGS=$GOFLAGS
ENV GO111MODULE=on

# Download dependencies first - this should be cacheable.
COPY go.mod go.sum ./
Expand All @@ -14,7 +13,7 @@ RUN go mod download
COPY . .

# Build the server.
RUN go get ./cmd/trillian_log_server
RUN go install ./cmd/trillian_log_server
# Run the licensing tool and save licenses, copyright notices, etc.
RUN go run github.com/google/go-licenses save ./cmd/trillian_log_server --save_path /THIRD_PARTY_NOTICES

Expand Down
5 changes: 2 additions & 3 deletions examples/deployment/docker/log_signer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
FROM golang:1.17-buster as build
FROM golang:1.19-buster as build

WORKDIR /trillian

ARG GOFLAGS=""
ENV GOFLAGS=$GOFLAGS
ENV GO111MODULE=on

# Download dependencies first - this should be cacheable.
COPY go.mod go.sum ./
Expand All @@ -14,7 +13,7 @@ RUN go mod download
COPY . .

# Build the signer.
RUN go get ./cmd/trillian_log_signer
RUN go install ./cmd/trillian_log_signer
# Run the licensing tool and save licenses, copyright notices, etc.
RUN go run github.com/google/go-licenses save ./cmd/trillian_log_signer --save_path /THIRD_PARTY_NOTICES

Expand Down
4 changes: 2 additions & 2 deletions experimental/batchmap/cmd/verify/verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"encoding/json"
"flag"
"fmt"
"io/ioutil"
"os"
"path/filepath"

"github.com/google/trillian/experimental/batchmap"
Expand Down Expand Up @@ -139,7 +139,7 @@ func getTilesForKey(mapDir string, key []byte) ([]*batchmap.Tile, error) {
for i := 0; i <= *prefixStrata; i++ {
tilePath := key[0:i]
tileFile := fmt.Sprintf("%s/path_%x", mapDir, tilePath)
in, err := ioutil.ReadFile(tileFile)
in, err := os.ReadFile(tileFile)
if err != nil {
return nil, fmt.Errorf("failed to read file %s: %v", tileFile, err)
}
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/google/trillian

go 1.17
go 1.19

require (
bitbucket.org/creachadair/shell v0.0.7
Expand Down
Loading

0 comments on commit 305388e

Please sign in to comment.