Skip to content

Commit

Permalink
Bump dependencies and golang version (#114)
Browse files Browse the repository at this point in the history
* bump dependencies and golang version to 1.22
* pin go.hollow.sh/toolbox to v0.6.2
* pin github.com/pressly/goose/v3 to v3.18.0
  • Loading branch information
fishnix authored May 9, 2024
1 parent 26cd278 commit 7db1753
Show file tree
Hide file tree
Showing 35 changed files with 368 additions and 277 deletions.
10 changes: 6 additions & 4 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ steps:
- label: ":golangci-lint: lint :lint-roller:"
key: "lint"
plugins:
- docker#v5.9.0:
image: "registry.hub.docker.com/golangci/golangci-lint:v1.53-alpine"
- docker#v5.10.0:
environment:
- GOFLAGS=-buildvcs=false
image: "registry.hub.docker.com/golangci/golangci-lint:v1.57-alpine"
command: ["golangci-lint", "run", "-v", "--timeout", "5m"]

- label: ":test_tube: test"
Expand All @@ -24,8 +26,8 @@ steps:
key: "gobuild"
artifact_paths: "bin/${APP_NAME}"
plugins:
- docker#v5.9.0:
image: "golang:1.20"
- docker#v5.10.0:
image: "golang:1.22"
environment:
- CGO_ENABLED=0
- GOOS=linux
Expand Down
3 changes: 3 additions & 0 deletions .devcontainer/.env
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ COCKROACH_INSECURE="true"
COCKROACH_HOST="crdb:26257"
COCKROACH_URL="postgresql://root@crdb:26257/governor_dev?sslmode=disable"

# sqlboiler config
CRDB_HOST=crdb

HYDRA_ADMIN_URL="http://hydra:4445"
HYDRA_URL="http://hydra:4444"

Expand Down
4 changes: 2 additions & 2 deletions .devcontainer/Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
ARG VARIANT=bullseye
ARG GO_VERSION=1.21
ARG GO_VERSION=1.22
ARG CRDB_VERSION=22.1.11

# Used to install cockroachdb into the devcontainer
FROM --platform=linux/amd64 cockroachdb/cockroach:v${CRDB_VERSION} as CRDB

FROM --platform=linux/amd64 mcr.microsoft.com/vscode/devcontainers/go:0-${GO_VERSION}-${VARIANT}
FROM --platform=linux/amd64 mcr.microsoft.com/vscode/devcontainers/go:${GO_VERSION}-${VARIANT}
ENV HYDRA_VERSION=1.11.10
ENV NATS_CLI_VERSION=0.0.35

Expand Down
2 changes: 0 additions & 2 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: "3.9"

volumes:
crdb-data:
hydra-sqlite:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.21 as builder
FROM golang:1.22 as builder

# Create and change to the app directory.
WORKDIR /app
Expand Down
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ PHONY: test test-local coverage lint golint clean vendor local-dev-databases doc

GOOS=linux
DB_STRING=host=localhost port=26257 user=root sslmode=disable
DB_STRING_DC=host=crdb port=26257 user=root sslmode=disable
DB_NAME=governor
DEV_DB=${DB_STRING} dbname=${DB_NAME}
TEST_DB=${DB_STRING} dbname=${DB_NAME}_test
TEST_DB_DC=${DB_STRING_DC} dbname=${DB_NAME}_test

# OAuth client generated secret
SECRET := $(shell bash -c 'openssl rand -hex 16')
Expand Down Expand Up @@ -118,6 +120,12 @@ ci-test: | unit-test
cockroach sql --url ${GOVERNOR_DB_URI} --insecure -e "create database ${DB_NAME}_test"
go run main.go migrate up

test-database-dc: | vendor
@cockroach sql --insecure -e "select version()"
@cockroach sql --insecure -e "drop database if exists ${DB_NAME}_test"
@cockroach sql --insecure -e "create database ${DB_NAME}_test"
GOVERNOR_DB_URI="${TEST_DB_DC}" go run main.go migrate up

test-database: | vendor
docker-compose -f docker-compose.yml up -d crdb
sleep 10
Expand All @@ -130,6 +138,10 @@ setup-test-database: | vendor
cockroach sql --insecure -e "drop database if exists governor_test; create database governor_test;"
GOVERNOR_DB_URI="host=crdb port=26257 user=root sslmode=disable dbname=governor_test" go run main.go migrate up

generate-models-dc:
$(MAKE) test-database-dc
sqlboiler --add-soft-deletes crdb

generate-models:
go install github.com/volatiletech/sqlboiler/v4@latest
go get -u github.com/glerchundi/sqlboiler-crdb/v4
Expand Down
9 changes: 5 additions & 4 deletions cmd/migrate.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package cmd

import (
"context"
"database/sql"

_ "github.com/cockroachdb/cockroach-go/v2/crdb/crdbpgx" // crdb retries and postgres interface
Expand Down Expand Up @@ -33,16 +34,16 @@ create NAME [sql|go] Creates new migration file with the current timestamp
fix Apply sequential ordering to migrations
`,
Args: cobra.MinimumNArgs(1),
Run: func(_ *cobra.Command, args []string) {
migrate(args[0], args[1:])
Run: func(cmd *cobra.Command, args []string) {
migrate(cmd.Context(), args[0], args[1:])
},
}

func init() {
rootCmd.AddCommand(migrateCmd)
}

func migrate(command string, args []string) {
func migrate(ctx context.Context, command string, args []string) {
db, err := goose.OpenDBWithDriver("postgres", viper.GetString("db.uri"))
if err != nil {
logger.Fatalw("failed to open DB", "error", err)
Expand All @@ -56,7 +57,7 @@ func migrate(command string, args []string) {

goose.SetBaseFS(dbm.Migrations)

if err := goose.Run(command, db, "migrations", args...); err != nil {
if err := goose.RunContext(ctx, command, db, "migrations", args...); err != nil {
logger.Fatalw("migrate command failed", "command", command, "error", err)
}
}
Expand Down
4 changes: 1 addition & 3 deletions docker-compose-ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: "3.9"

services:
crdb:
image: cockroachdb/cockroach:v22.1.11
Expand All @@ -11,7 +9,7 @@ services:
- governor

go:
image: golang:1.21
image: golang:1.22
depends_on:
- crdb
environment:
Expand Down
2 changes: 0 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: "3.9"

services:
api:
build:
Expand Down
123 changes: 62 additions & 61 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,93 +1,95 @@
module github.com/metal-toolbox/governor-api

go 1.20
go 1.22

require (
github.com/XSAM/otelsql v0.26.0
github.com/cockroachdb/cockroach-go/v2 v2.3.5
github.com/coreos/go-oidc/v3 v3.7.0
github.com/XSAM/otelsql v0.31.0
github.com/cockroachdb/cockroach-go/v2 v2.3.8
github.com/coreos/go-oidc/v3 v3.10.0
github.com/friendsofgo/errors v0.9.2
github.com/gin-contrib/cors v1.4.0
github.com/gin-contrib/zap v0.2.0
github.com/gin-gonic/gin v1.9.1
github.com/gin-contrib/cors v1.7.2
github.com/gin-contrib/zap v1.1.3
github.com/gin-gonic/gin v1.10.0
github.com/goccy/go-json v0.10.2
github.com/google/uuid v1.4.0
github.com/gosimple/slug v1.13.1
github.com/google/uuid v1.6.0
github.com/gosimple/slug v1.14.0
github.com/jmoiron/sqlx v1.3.5
github.com/lib/pq v1.10.9
github.com/metal-toolbox/auditevent v0.8.0
github.com/mitchellh/go-homedir v1.1.0
github.com/nats-io/nats.go v1.34.1
github.com/pressly/goose/v3 v3.15.1
github.com/pressly/goose/v3 v3.18.0
github.com/santhosh-tekuri/jsonschema/v5 v5.3.1
github.com/spf13/cobra v1.7.0
github.com/spf13/cobra v1.8.0
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.18.2
github.com/stretchr/testify v1.8.4
github.com/stretchr/testify v1.9.0
github.com/volatiletech/null/v8 v8.1.2
github.com/volatiletech/sqlboiler/v4 v4.16.1
github.com/volatiletech/sqlboiler/v4 v4.16.2
github.com/volatiletech/strmangle v0.0.6
github.com/zsais/go-gin-prometheus v0.1.0
go.hollow.sh/toolbox v0.6.2
go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin v0.45.0
go.opentelemetry.io/otel v1.19.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0
go.opentelemetry.io/otel/sdk v1.19.0
go.uber.org/zap v1.26.0
golang.org/x/oauth2 v0.15.0
go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin v0.51.0
go.opentelemetry.io/otel v1.26.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.26.0
go.opentelemetry.io/otel/sdk v1.26.0
go.uber.org/zap v1.27.0
golang.org/x/oauth2 v0.20.0
gopkg.in/square/go-jose.v2 v2.6.0
)

require (
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
github.com/chenzhuoyu/iasm v0.9.0 // indirect
github.com/bytedance/sonic/loader v0.1.1 // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/cloudwego/base64x v0.1.4 // indirect
github.com/cloudwego/iasm v0.2.0 // indirect
github.com/go-jose/go-jose/v4 v4.0.1 // indirect
github.com/gofrs/flock v0.8.1 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.0 // indirect
github.com/klauspost/compress v1.17.2 // indirect
github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1 // indirect
github.com/klauspost/compress v1.17.8 // indirect
github.com/mfridman/interpolate v0.0.2 // indirect
github.com/sagikazarmark/locafero v0.4.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/sethvargo/go-retry v0.2.4 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
go.opentelemetry.io/proto/otlp v1.0.0 // indirect
golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f // indirect
google.golang.org/grpc v1.59.0 // indirect
go.opentelemetry.io/proto/otlp v1.2.0 // indirect
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 // indirect
golang.org/x/sync v0.7.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240506185236-b8a5c65736ae // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240506185236-b8a5c65736ae // indirect
google.golang.org/grpc v1.63.2 // indirect
)

require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/bytedance/sonic v1.10.2 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d // indirect
github.com/bytedance/sonic v1.11.6 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/ericlagergren/decimal v0.0.0-20221120152707-495c53812d05 // indirect
github.com/ericlagergren/decimal v0.0.0-20240411145413-00de7ca16731 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-jose/go-jose/v3 v3.0.1 // indirect
github.com/go-logr/logr v1.3.0 // indirect
github.com/go-logr/logr v1.4.1 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-logr/zapr v1.2.4 // indirect
github.com/go-logr/zapr v1.3.0 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.15.5 // indirect
github.com/go-playground/validator/v10 v10.20.0 // indirect
github.com/gofrs/uuid v4.4.0+incompatible // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/gosimple/unidecode v1.0.1 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jackc/chunkreader/v2 v2.0.1 // indirect
github.com/jackc/pgconn v1.14.1 // indirect
github.com/jackc/pgconn v1.14.3 // indirect
github.com/jackc/pgio v1.0.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgproto3/v2 v2.3.2 // indirect
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect
github.com/jackc/pgtype v1.14.0 // indirect
github.com/jackc/pgx/v4 v4.18.1 // indirect
github.com/jackc/pgproto3/v2 v2.3.3 // indirect
github.com/jackc/pgservicefile v0.0.0-20231201235250-de7065d80cb9 // indirect
github.com/jackc/pgtype v1.14.3 // indirect
github.com/jackc/pgx/v4 v4.18.3 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/cpuid/v2 v2.2.5 // indirect
github.com/leodido/go-urn v1.2.4 // indirect
github.com/klauspost/cpuid/v2 v2.2.7 // indirect
github.com/leodido/go-urn v1.4.0 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-sqlite3 v2.0.3+incompatible // indirect
Expand All @@ -96,32 +98,31 @@ require (
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/nats-io/nkeys v0.4.7 // indirect
github.com/nats-io/nuid v1.0.1 // indirect
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus/client_golang v1.17.0
github.com/prometheus/client_model v0.5.0 // indirect
github.com/prometheus/common v0.45.0 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/prometheus/client_golang v1.19.0
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.53.0 // indirect
github.com/prometheus/procfs v0.14.0 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/spf13/afero v1.11.0 // indirect
github.com/spf13/cast v1.6.0 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.2.11 // indirect
github.com/ugorji/go/codec v1.2.12 // indirect
github.com/volatiletech/inflect v0.0.1 // indirect
github.com/volatiletech/randomize v0.0.1 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.19.0
go.opentelemetry.io/otel/metric v1.19.0 // indirect
go.opentelemetry.io/otel/trace v1.19.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.26.0
go.opentelemetry.io/otel/metric v1.26.0 // indirect
go.opentelemetry.io/otel/trace v1.26.0
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/arch v0.5.0 // indirect
golang.org/x/crypto v0.18.0 // indirect
golang.org/x/net v0.19.0 // indirect
golang.org/x/sys v0.16.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/arch v0.8.0 // indirect
golang.org/x/crypto v0.23.0 // indirect
golang.org/x/net v0.25.0 // indirect
golang.org/x/sys v0.20.0 // indirect
golang.org/x/text v0.15.0 // indirect
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/protobuf v1.31.0 // indirect
google.golang.org/protobuf v1.34.1 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit 7db1753

Please sign in to comment.