Skip to content
This repository has been archived by the owner on Jul 12, 2023. It is now read-only.

Commit

Permalink
Upgrade to Go 1.16 (#1865)
Browse files Browse the repository at this point in the history
- Replace signalcontext with stdlib
- Replace ioutil with stdlib
  • Loading branch information
sethvargo authored Feb 25, 2021
1 parent 91886a2 commit 17e0f5c
Show file tree
Hide file tree
Showing 38 changed files with 135 additions and 176 deletions.
26 changes: 22 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,16 @@ jobs:

- uses: actions/setup-go@v2
with:
go-version: '1.15'
go-version: '1.16'

- uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ runner.os }}-go-test-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-test-
${{ runner.os }}-go-
- name: go-test
Expand Down Expand Up @@ -76,10 +79,25 @@ jobs:
- name: Install pcregrep
run: sudo apt-get -yqq install pcregrep

- uses: actions/setup-go@v2
with:
go-version: '1.16'

- uses: actions/cache@v2
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ runner.os }}-go-lint-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-lint-
${{ runner.os }}-go-
- name: go-lint
uses: golangci/golangci-lint-action@v2
with:
version: v1.36.0
version: 'v1.37'
skip-go-installation: true
only-new-issues: true

- name: zapw-logger
Expand Down
4 changes: 2 additions & 2 deletions builders/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ steps:
- '-allow-failure'

- id: 'download-modules'
name: 'golang:1.15.2'
name: 'golang:1.16'
args:
- 'go'
- 'install'
Expand All @@ -75,7 +75,7 @@ steps:
- 'bin'

- id: 'build'
name: 'golang:1.15.2'
name: 'golang:1.16'
args:
- 'go'
- 'build'
Expand Down
6 changes: 3 additions & 3 deletions cmd/adminapi/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import (
"crypto/sha1"
"fmt"
"os"
"os/signal"
"syscall"

"github.com/google/exposure-notifications-verification-server/internal/buildinfo"
"github.com/google/exposure-notifications-verification-server/internal/routes"
Expand All @@ -33,12 +35,10 @@ import (
"github.com/google/exposure-notifications-server/pkg/logging"
"github.com/google/exposure-notifications-server/pkg/observability"
"github.com/google/exposure-notifications-server/pkg/server"

"github.com/sethvargo/go-signalcontext"
)

func main() {
ctx, done := signalcontext.OnInterrupt()
ctx, done := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)

logger := logging.NewLoggerFromEnv().
With("build_id", buildinfo.BuildID).
Expand Down
6 changes: 3 additions & 3 deletions cmd/apiserver/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import (
"crypto/sha1"
"fmt"
"os"
"os/signal"
"syscall"

"github.com/google/exposure-notifications-verification-server/internal/buildinfo"
"github.com/google/exposure-notifications-verification-server/internal/routes"
Expand All @@ -33,12 +35,10 @@ import (
"github.com/google/exposure-notifications-server/pkg/logging"
"github.com/google/exposure-notifications-server/pkg/observability"
"github.com/google/exposure-notifications-server/pkg/server"

"github.com/sethvargo/go-signalcontext"
)

func main() {
ctx, done := signalcontext.OnInterrupt()
ctx, done := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)

logger := logging.NewLoggerFromEnv().
With("build_id", buildinfo.BuildID).
Expand Down
5 changes: 3 additions & 2 deletions cmd/appsync/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import (
"context"
"fmt"
"net/http"
"os/signal"
"syscall"

"github.com/google/exposure-notifications-verification-server/internal/buildinfo"
"github.com/google/exposure-notifications-verification-server/pkg/config"
Expand All @@ -31,11 +33,10 @@ import (
"github.com/google/exposure-notifications-server/pkg/server"

"github.com/gorilla/mux"
"github.com/sethvargo/go-signalcontext"
)

func main() {
ctx, done := signalcontext.OnInterrupt()
ctx, done := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)

logger := logging.NewLoggerFromEnv().
With("build_id", buildinfo.BuildID).
Expand Down
5 changes: 3 additions & 2 deletions cmd/cleanup/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import (
"context"
"fmt"
"net/http"
"os/signal"
"syscall"

"github.com/google/exposure-notifications-verification-server/internal/buildinfo"
"github.com/google/exposure-notifications-verification-server/pkg/config"
Expand All @@ -33,11 +35,10 @@ import (
"github.com/google/exposure-notifications-server/pkg/server"

"github.com/gorilla/mux"
"github.com/sethvargo/go-signalcontext"
)

func main() {
ctx, done := signalcontext.OnInterrupt()
ctx, done := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)

logger := logging.NewLoggerFromEnv().
With("build_id", buildinfo.BuildID).
Expand Down
5 changes: 3 additions & 2 deletions cmd/e2e-runner/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import (
"fmt"
"net/http"
"os"
"os/signal"
"syscall"
"time"

"github.com/google/exposure-notifications-server/pkg/logging"
Expand All @@ -36,11 +38,10 @@ import (

"github.com/gorilla/handlers"
"github.com/gorilla/mux"
"github.com/sethvargo/go-signalcontext"
)

func main() {
ctx, done := signalcontext.OnInterrupt()
ctx, done := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)

logger := logging.NewLoggerFromEnv().
With("build_id", buildinfo.BuildID).
Expand Down
6 changes: 3 additions & 3 deletions cmd/enx-redirect/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import (
"crypto/sha1"
"fmt"
"os"
"os/signal"
"syscall"

"github.com/google/exposure-notifications-verification-server/internal/buildinfo"
"github.com/google/exposure-notifications-verification-server/internal/routes"
Expand All @@ -29,12 +31,10 @@ import (
"github.com/google/exposure-notifications-server/pkg/logging"
"github.com/google/exposure-notifications-server/pkg/observability"
"github.com/google/exposure-notifications-server/pkg/server"

"github.com/sethvargo/go-signalcontext"
)

func main() {
ctx, done := signalcontext.OnInterrupt()
ctx, done := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)

logger := logging.NewLoggerFromEnv().
With("build_id", buildinfo.BuildID).
Expand Down
5 changes: 3 additions & 2 deletions cmd/migrate/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import (
"context"
"flag"
"fmt"
"os/signal"
"syscall"

"github.com/google/exposure-notifications-verification-server/internal/buildinfo"
"github.com/google/exposure-notifications-verification-server/pkg/config"
Expand All @@ -28,7 +30,6 @@ import (

_ "github.com/jinzhu/gorm/dialects/postgres"
"github.com/sethvargo/go-envconfig"
"github.com/sethvargo/go-signalcontext"
)

var (
Expand All @@ -39,7 +40,7 @@ var (
func main() {
flag.Parse()

ctx, done := signalcontext.OnInterrupt()
ctx, done := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)

logger := logging.NewLoggerFromEnv().
With("build_id", buildinfo.BuildID).
Expand Down
5 changes: 3 additions & 2 deletions cmd/modeler/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import (
"crypto/sha1"
"fmt"
"net/http"
"os/signal"
"syscall"

"github.com/google/exposure-notifications-verification-server/internal/buildinfo"
"github.com/google/exposure-notifications-verification-server/pkg/cache"
Expand All @@ -35,11 +37,10 @@ import (
"github.com/google/exposure-notifications-server/pkg/server"

"github.com/gorilla/mux"
"github.com/sethvargo/go-signalcontext"
)

func main() {
ctx, done := signalcontext.OnInterrupt()
ctx, done := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)

logger := logging.NewLoggerFromEnv().
With("build_id", buildinfo.BuildID).
Expand Down
5 changes: 3 additions & 2 deletions cmd/rotation/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import (
"context"
"fmt"
"net/http"
"os/signal"
"syscall"

"github.com/google/exposure-notifications-verification-server/internal/buildinfo"
"github.com/google/exposure-notifications-verification-server/pkg/config"
Expand All @@ -33,11 +35,10 @@ import (
"github.com/google/exposure-notifications-server/pkg/server"

"github.com/gorilla/mux"
"github.com/sethvargo/go-signalcontext"
)

func main() {
ctx, done := signalcontext.OnInterrupt()
ctx, done := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)

logger := logging.NewLoggerFromEnv().
With("build_id", buildinfo.BuildID).
Expand Down
6 changes: 3 additions & 3 deletions cmd/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import (
"crypto/sha1"
"fmt"
"os"
"os/signal"
"syscall"

"github.com/google/exposure-notifications-verification-server/internal/auth"
"github.com/google/exposure-notifications-verification-server/internal/buildinfo"
Expand All @@ -32,12 +34,10 @@ import (
"github.com/google/exposure-notifications-server/pkg/logging"
"github.com/google/exposure-notifications-server/pkg/observability"
"github.com/google/exposure-notifications-server/pkg/server"

"github.com/sethvargo/go-signalcontext"
)

func main() {
ctx, done := signalcontext.OnInterrupt()
ctx, done := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)

logger := logging.NewLoggerFromEnv().
With("build_id", buildinfo.BuildID).
Expand Down
5 changes: 3 additions & 2 deletions cmd/stats-puller/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import (
"context"
"fmt"
"net/http"
"os/signal"
"syscall"

"github.com/google/exposure-notifications-verification-server/internal/buildinfo"
"github.com/google/exposure-notifications-verification-server/internal/clients"
Expand All @@ -34,11 +36,10 @@ import (
"github.com/google/exposure-notifications-server/pkg/server"

"github.com/gorilla/mux"
"github.com/sethvargo/go-signalcontext"
)

func main() {
ctx, done := signalcontext.OnInterrupt()
ctx, done := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)

logger := logging.NewLoggerFromEnv().
With("build_id", buildinfo.BuildID).
Expand Down
2 changes: 1 addition & 1 deletion docs/images/architecture/go.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module github.com/google/exposure-notifications-verification-server/docs/images/architecture

go 1.15
go 1.16

require github.com/blushft/go-diagrams v0.0.0-20200926141704-5a1c57dcd0fb
3 changes: 1 addition & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/google/exposure-notifications-verification-server

go 1.15
go 1.16

require (
cloud.google.com/go v0.77.0
Expand Down Expand Up @@ -48,7 +48,6 @@ require (
github.com/sethvargo/go-password v0.2.0
github.com/sethvargo/go-redisstore v0.3.0-opencensus
github.com/sethvargo/go-retry v0.1.0
github.com/sethvargo/go-signalcontext v0.1.0
github.com/sethvargo/zapw v0.1.0
github.com/sirupsen/logrus v1.7.1 // indirect
github.com/stretchr/testify v1.7.0 // indirect
Expand Down
Loading

0 comments on commit 17e0f5c

Please sign in to comment.