diff --git a/.github/workflows/go-format.yml b/.github/workflows/go-format.yml
index ab87256..3ca6ecc 100644
--- a/.github/workflows/go-format.yml
+++ b/.github/workflows/go-format.yml
@@ -11,7 +11,7 @@ jobs:
steps:
- uses: actions/setup-go@v2
with:
- go-version: '1.17'
+ go-version: '1.18'
- name: Install goimports
run: go install golang.org/x/tools/cmd/goimports@latest
diff --git a/.github/workflows/go-test.yml b/.github/workflows/go-test.yml
index 9f6a71b..2a59e3f 100644
--- a/.github/workflows/go-test.yml
+++ b/.github/workflows/go-test.yml
@@ -12,7 +12,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v2
with:
- go-version: '1.17'
+ go-version: '1.18'
- name: Set up gotestfmt
uses: haveyoudebuggedit/gotestfmt-action@v1
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 080250b..7591264 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -18,6 +18,10 @@ This project tries to follow [SemVer 2.0.0](https://semver.org/).
so it no longer automatically indents for desktop, mobile, or tablet devices.
It is still enabled for cURL and if the `?pretty` flag is set. (#170)
+- Changed Go runtime from v1.17 to v1.18. (#171)
+
+- Changed version of `github.com/swaggo/swag` from v1.8.0 to v1.8.1. (#171)
+
## v5.1.2 (2022-03-08)
- Fixed token in trigger URL used in HTTP request getting redacted, instead of
diff --git a/Dockerfile b/Dockerfile
index 0dd35d5..d3eafed 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,7 +1,7 @@
ARG REG=docker.io
-FROM ${REG}/library/golang:1.17 AS build
+FROM ${REG}/library/golang:1.18 AS build
WORKDIR /src
-RUN go install github.com/swaggo/swag/cmd/swag@v1.7.1
+RUN go install github.com/swaggo/swag/cmd/swag@v1.8.1
COPY go.mod go.sum ./
RUN go mod download
diff --git a/Makefile b/Makefile
index 2cf3991..09133da 100644
--- a/Makefile
+++ b/Makefile
@@ -22,7 +22,7 @@ tidy:
deps:
go install github.com/mgechev/revive@latest
go install golang.org/x/tools/cmd/goimports@latest
- go install github.com/swaggo/swag/cmd/swag@v1.8.0
+ go install github.com/swaggo/swag/cmd/swag@v1.8.1
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.26
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.1
go install github.com/alta/protopatch/cmd/protoc-gen-go-patch@v0.5.0
diff --git a/README.md b/README.md
index fab9815..872d8ba 100644
--- a/README.md
+++ b/README.md
@@ -27,7 +27,7 @@ optional config files. See the docs on the `Config` type over at:
## Development
-1. Install Go 1.17 or later:
+1. Install Go 1.18 or later:
2. Install dependencies using [GNU Make](https://www.gnu.org/software/make/) or
[GNUWin32](http://gnuwin32.sourceforge.net/install.html)
@@ -56,7 +56,7 @@ or [GNUWin32](http://gnuwin32.sourceforge.net/install.html):
```console
$ make docker version=v2.0.0
-STEP 1: FROM golang:1.17 AS build
+STEP 1: FROM golang:1.18 AS build
STEP 2: WORKDIR /src
--> Using cache de3476fd68836750f453d9d4e7b592549fa924c14e68c9b80069881de8aacc9b
--> de3476fd688
diff --git a/build.go b/build.go
index 576a3cc..98d6afb 100644
--- a/build.go
+++ b/build.go
@@ -65,13 +65,13 @@ func (m buildModule) Register(g *gin.RouterGroup) {
var buildChannels = make(map[uint]broadcast.Broadcaster)
-func openListener(buildID uint) chan interface{} {
- listener := make(chan interface{})
+func openListener(buildID uint) chan any {
+ listener := make(chan any)
build(buildID).Register(listener)
return listener
}
-func closeListener(buildID uint, listener chan interface{}) {
+func closeListener(buildID uint, listener chan any) {
build(buildID).Unregister(listener)
close(listener)
}
@@ -261,7 +261,7 @@ func (m buildModule) getBuildListHandler(c *gin.Context) {
}
if len(statusIDs) > 0 {
- ids := make([]interface{}, len(statusIDs))
+ ids := make([]any, len(statusIDs))
for i, status := range statusIDs {
ids[i] = int(status.id)
}
@@ -466,7 +466,7 @@ func createLogBatchPostgresQuery(db *gorm.DB, dbLogs []database.Log) *gorm.DB {
// Based on:
// https://stackoverflow.com/a/36039580
var sb strings.Builder
- var params []interface{}
+ var params []any
// Looping in reverse order as the "RETURNING" produces rows in reverse
for i := len(dbLogs) - 1; i >= 0; i-- {
if sb.Len() == 0 {
@@ -969,7 +969,7 @@ func getDBJobParams(
var err error
var v []byte
if len(dbBuildParams) > 0 {
- m := make(map[string]interface{})
+ m := make(map[string]any)
for _, input := range dbBuildParams {
m[input.Name] = input.Value
diff --git a/go.mod b/go.mod
index d117ad6..a1878e9 100644
--- a/go.mod
+++ b/go.mod
@@ -1,8 +1,9 @@
module github.com/iver-wharf/wharf-api/v5
-go 1.17
+go 1.18
require (
+ github.com/alta/protopatch v0.5.0
github.com/dustin/go-broadcast v0.0.0-20171205050544-f664265f5a66
github.com/ghodss/yaml v1.0.0
github.com/gin-contrib/cors v1.3.1
@@ -13,15 +14,13 @@ require (
github.com/mileusna/useragent v1.0.2
github.com/stretchr/testify v1.7.0
github.com/swaggo/gin-swagger v1.4.1
- github.com/swaggo/swag v1.8.0
+ github.com/swaggo/swag v1.8.1
gopkg.in/guregu/null.v4 v4.0.0
gorm.io/driver/postgres v1.2.3
gorm.io/driver/sqlite v1.2.6
gorm.io/gorm v1.22.5
)
-require github.com/alta/protopatch v0.5.0
-
require (
github.com/KyleBanks/depth v1.2.1 // indirect
github.com/PuerkitoBio/purell v1.1.1 // indirect
@@ -72,10 +71,10 @@ require (
github.com/subosito/gotenv v1.2.0 // indirect
github.com/ugorji/go/codec v1.2.7 // indirect
golang.org/x/crypto v0.0.0-20220214200702-86341886e292 // indirect
- golang.org/x/net v0.0.0-20220225172249-27dd8689420f // indirect
- golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9 // indirect
+ golang.org/x/net v0.0.0-20220325170049-de3da57026de // indirect
+ golang.org/x/sys v0.0.0-20220330033206-e17cdc41300f // indirect
golang.org/x/text v0.3.7 // indirect
- golang.org/x/tools v0.1.9 // indirect
+ golang.org/x/tools v0.1.10 // indirect
google.golang.org/genproto v0.0.0-20220217155828-d576998c0009 // indirect
google.golang.org/grpc v1.44.0
google.golang.org/protobuf v1.27.1
diff --git a/go.sum b/go.sum
index ef163fe..4c776a9 100644
--- a/go.sum
+++ b/go.sum
@@ -103,11 +103,9 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m
github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
-github.com/envoyproxy/protoc-gen-validate v0.6.2/go.mod h1:2t7qjJNvHPx8IjnBOzl9E9/baC+qXE/TeeyBRzgJDws=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/fatih/color v1.12.0 h1:mRhaKNwANqRgUBGKmnI5ZxEk7QXmjQeCcuYFMX2bfcc=
github.com/fatih/color v1.12.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM=
-github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94=
github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4=
github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20=
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
@@ -255,12 +253,10 @@ github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2p
github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg=
-github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo=
github.com/iver-wharf/wharf-core v1.3.0 h1:iJqa0JYBkMmJDkBKeErKCpZCa+qa97u5MLMBQ685Jhs=
github.com/iver-wharf/wharf-core v1.3.0/go.mod h1:dpYtdL52i17Aue7An6mJL9dICeulBDsGZO/PxZYHgrE=
-github.com/jackc/chunkreader v1.0.0 h1:4s39bBR8ByfqH+DKm8rQA3E1LHZWB9XWcrz8fqaZbe0=
github.com/jackc/chunkreader v1.0.0/go.mod h1:RT6O25fNZIuasFJRyZ4R/Y2BbhasbmZXF9QQ7T3kePo=
github.com/jackc/chunkreader/v2 v2.0.0/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk=
github.com/jackc/chunkreader/v2 v2.0.1 h1:i+RDz65UE+mmpjTfyz0MoVTnzeYxroil2G82ki7MGG8=
@@ -287,7 +283,6 @@ github.com/jackc/pgmock v0.0.0-20210724152146-4ad1a8207f65 h1:DadwsjnMwFjfWc9y5W
github.com/jackc/pgmock v0.0.0-20210724152146-4ad1a8207f65/go.mod h1:5R2h2EEX+qri8jOWMbJCtaPWkrrNc7OHwsp2TCqp7ak=
github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM=
github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg=
-github.com/jackc/pgproto3 v1.1.0 h1:FYYE4yRw+AgI8wXIinMlNjBbp/UitDJwfj5LqqewP1A=
github.com/jackc/pgproto3 v1.1.0/go.mod h1:eR5FA3leWg7p9aeAqi37XOTgTIbkABlvcPB3E5rlc78=
github.com/jackc/pgproto3/v2 v2.0.0-alpha1.0.20190420180111-c116219b62db/go.mod h1:bhq50y+xrl9n5mRYyCBFKkpRVTLYJVWeCc+mEAI3yXA=
github.com/jackc/pgproto3/v2 v2.0.0-alpha1.0.20190609003834-432c2951c711/go.mod h1:uH0AWtUmuShn0bcesswc4aBTWGvw0cAxIJp+6OB//Wg=
@@ -382,7 +377,6 @@ github.com/lib/pq v1.10.2 h1:AqzbZs4ZoCBp+GtejcpCpcxM3zlSMx29dXbUSeVtJb8=
github.com/lib/pq v1.10.2/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM=
github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4=
-github.com/lyft/protoc-gen-star v0.5.3/go.mod h1:V0xaHgaf5oCCqmcxYcWiDfTiKsZsRc87/1qhoTACD8w=
github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ=
github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4=
github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
@@ -533,7 +527,6 @@ github.com/soheilhy/cmux v0.1.5/go.mod h1:T7TcVDs9LWfQgPlPsdngu6I6QIoyIFZDDC6sNE
github.com/sony/gobreaker v0.4.1/go.mod h1:ZKptC7FHNvhBz7dN2LGjPVBz2sZJmc0/PkyDJOjmxWY=
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
-github.com/spf13/afero v1.3.3/go.mod h1:5KUK8ByomD5Ti5Artl0RtHeI5pTF7MIDuXL3yY520V4=
github.com/spf13/afero v1.6.0 h1:xoax2sJ2DT8S8xA2paPFjDCScCNeWsg75VG0DLRreiY=
github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I=
github.com/spf13/cast v1.3.0 h1:oget//CVOEoFewqQxwr0Ej5yjygnqGkvggSE/gB35Q8=
@@ -565,12 +558,11 @@ github.com/swaggo/files v0.0.0-20210815190702-a29dd2bc99b2/go.mod h1:lKJPbtWzJ9J
github.com/swaggo/gin-swagger v1.4.1 h1:F2vJndw+Q+ZBOlsC6CaodqXJV3ZOf6hpg/4Y6MEx5BM=
github.com/swaggo/gin-swagger v1.4.1/go.mod h1:hmJ1vPn+XjUvnbzjCdUAxVqgraxELxk8x5zAsjCE5mg=
github.com/swaggo/swag v1.7.9/go.mod h1:gZ+TJ2w/Ve1RwQsA2IRoSOTidHz6DX+PIG8GWvbnoLU=
-github.com/swaggo/swag v1.8.0 h1:80NNhvpJcuItNpBDqgJwDuKlMmaZ/OATOzhG3bhcM3w=
-github.com/swaggo/swag v1.8.0/go.mod h1:gZ+TJ2w/Ve1RwQsA2IRoSOTidHz6DX+PIG8GWvbnoLU=
+github.com/swaggo/swag v1.8.1 h1:JuARzFX1Z1njbCGz+ZytBR15TFJwF2Q7fu8puJHhQYI=
+github.com/swaggo/swag v1.8.1/go.mod h1:ugemnJsPZm/kRwFUnzBlbHRd0JY9zE1M4F+uy2pAaPQ=
github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw=
-github.com/ugorji/go v1.2.7 h1:qYhyWUUd6WbiM+C6JZAUkIJt/1WrjzNHY9+KCIjVqTo=
github.com/ugorji/go v1.2.7/go.mod h1:nF9osbDWLy6bDVv/Rtoh6QgnvNDpmCalQV5urGCCS6M=
github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY=
github.com/ugorji/go/codec v1.2.7 h1:YPXUKf7fYbp/y8xloBqZOw2qaVggbfwMlI8WM3wZUJ0=
@@ -579,9 +571,7 @@ github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijb
github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI=
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
-github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
github.com/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
-github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q=
go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
@@ -637,16 +627,13 @@ golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHl
golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
-golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE=
golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o=
golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY=
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
-golang.org/x/mod v0.5.0/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro=
-golang.org/x/mod v0.5.1 h1:OJxoQ/rynoF0dcCdI7cLPktw/hR2cueqYfjm43oqK38=
-golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro=
+golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3 h1:kQgndtyPBW/JIYERgdxfwMYh3AVStj88WQTlNDi2a+o=
golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
@@ -674,12 +661,9 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
golang.org/x/net v0.0.0-20210421230115-4e50805a0758/go.mod h1:72T/g9IO56b78aLF+1Kcs5dz7/ng1VjMUvfKvpfy+jM=
golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
-golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
-golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
-golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
-golang.org/x/net v0.0.0-20220225172249-27dd8689420f h1:oA4XRj0qtSt8Yo1Zms0CUlsT3KG69V2UGQWPBxujDmc=
-golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
+golang.org/x/net v0.0.0-20220325170049-de3da57026de h1:pZB1TWnKi+o4bENlbzAgLrEbY4RMYmUIRobMcSmfeYc=
+golang.org/x/net v0.0.0-20220325170049-de3da57026de/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
@@ -727,11 +711,9 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
-golang.org/x/sys v0.0.0-20210816183151-1e6c022a8912/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
-golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
-golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9 h1:nhht2DYV/Sn3qOayu8lM+cU1ii9sTLUeBQwQQfUHtrs=
-golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20220330033206-e17cdc41300f h1:rlezHXNlxYWvBCzNses9Dlc7nGFaNMJeqLolcmQSSZY=
+golang.org/x/sys v0.0.0-20220330033206-e17cdc41300f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
@@ -773,11 +755,9 @@ golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtn
golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
-golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
-golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo=
-golang.org/x/tools v0.1.9 h1:j9KsMiaP1c3B0OTQGth0/k+miLGTgLsAFUCrF2vLcF8=
-golang.org/x/tools v0.1.9/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU=
+golang.org/x/tools v0.1.10 h1:QjFRCZxdOhBJ/UNgnBZLbNV13DlbnK0quyivTnXJM20=
+golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E=
golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
@@ -826,7 +806,6 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp
google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
google.golang.org/grpc v1.44.0 h1:weqSxi/TMs1SqFRMHCtBgXRs8k3X39QIDEZ0pRcttUg=
google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU=
-google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
diff --git a/internal/set/set.go b/internal/set/set.go
index dcd3369..fcb1f4d 100644
--- a/internal/set/set.go
+++ b/internal/set/set.go
@@ -7,7 +7,7 @@ import (
type emptyStruct struct{}
-func goString(set interface{}, values []interface{}) string {
+func goString(set any, values []any) string {
var sb strings.Builder
fmt.Fprintf(&sb, "%T{", set)
for i, value := range values {
diff --git a/internal/set/strings.go b/internal/set/strings.go
index 100b31a..5b0e7e6 100644
--- a/internal/set/strings.go
+++ b/internal/set/strings.go
@@ -49,7 +49,7 @@ func (set Strings) String() string {
func (set Strings) GoString() string {
values := set.Slice()
sort.Strings(values)
- valuesInterfaces := make([]interface{}, len(values))
+ valuesInterfaces := make([]any, len(values))
for i, v := range values {
valuesInterfaces[i] = v
}
diff --git a/internal/wherefields/wherefields.go b/internal/wherefields/wherefields.go
index c6d7e7f..5e0c82d 100644
--- a/internal/wherefields/wherefields.go
+++ b/internal/wherefields/wherefields.go
@@ -5,12 +5,12 @@ import "gopkg.in/guregu/null.v4"
// Collection stores field names of non-nil values. Meant to be used with the
// GORM .Where() clause.
type Collection struct {
- fieldNames []interface{}
+ fieldNames []any
}
// NonNilFieldNames returns the slice of field names. Meant to be used as the
// trailing arguments to the GORM .Where() clause.
-func (sc *Collection) NonNilFieldNames() []interface{} {
+func (sc *Collection) NonNilFieldNames() []any {
return sc.fieldNames
}
diff --git a/migrations.go b/migrations.go
index 7040a42..e545df9 100644
--- a/migrations.go
+++ b/migrations.go
@@ -32,7 +32,7 @@ func migrateInitSchema(db *gorm.DB) error {
if err := migrateBeforeGormigrate(db); err != nil {
return err
}
- tables := []interface{}{
+ tables := []any{
&database.Token{}, &database.Provider{},
&database.Project{}, &database.ProjectOverrides{},
&database.Branch{}, &database.Build{}, &database.Log{},
diff --git a/migrations_old.go b/migrations_old.go
index da67123..eb034b9 100644
--- a/migrations_old.go
+++ b/migrations_old.go
@@ -120,7 +120,7 @@ func dropOldConstraint(db *gorm.DB, table string, constraintName string) error {
}
type columnToDrop struct {
- model interface{}
+ model any
columnName string
}
@@ -134,7 +134,7 @@ func dropOldColumns(db *gorm.DB, columns []columnToDrop) error {
return nil
}
-func dropOldColumn(db *gorm.DB, model interface{}, columnName string) error {
+func dropOldColumn(db *gorm.DB, model any, columnName string) error {
if db.Migrator().HasColumn(model, columnName) {
log.Info().
WithString("column", columnName).
@@ -230,7 +230,7 @@ func migrateWharfColumnsToNotNull(db *gorm.DB) error {
return nil
}
-func migrateColumnsToNotNull(db *gorm.DB, model interface{}, fieldNames ...string) error {
+func migrateColumnsToNotNull(db *gorm.DB, model any, fieldNames ...string) error {
if !db.Migrator().HasTable(model) {
log.Debug().WithStringf("model", "%T", model).Message("Skipping changing column to not null as the table does not exist.")
return nil
@@ -271,7 +271,7 @@ func migrateColumnsToNotNull(db *gorm.DB, model interface{}, fieldNames ...strin
})
}
-func migrateColumnToNotNull(db *gorm.DB, model interface{}, want *schema.Field, actual gorm.ColumnType) error {
+func migrateColumnToNotNull(db *gorm.DB, model any, want *schema.Field, actual gorm.ColumnType) error {
if want.PrimaryKey {
return fmt.Errorf("cannot operate changing the column to not null for a primary key: %q", want.Name)
}
@@ -333,7 +333,7 @@ func migrateColumnToNotNull(db *gorm.DB, model interface{}, want *schema.Field,
return nil
}
-func sqlDefaultValue(dataType schema.DataType) (interface{}, error) {
+func sqlDefaultValue(dataType schema.DataType) (any, error) {
switch dataType {
case schema.Bool:
return false, nil
diff --git a/oidc_middleware.go b/oidc_middleware.go
index c945d44..bd89eaa 100644
--- a/oidc_middleware.go
+++ b/oidc_middleware.go
@@ -105,7 +105,7 @@ func (m *oidcMiddleware) VerifyTokenMiddleware(ginContext *gin.Context) {
return
}
tokenString = strings.TrimPrefix(tokenString, "Bearer ")
- token, err := jwt.Parse(tokenString, func(token *jwt.Token) (interface{}, error) {
+ token, err := jwt.Parse(tokenString, func(token *jwt.Token) (any, error) {
if kid, ok := token.Header["kid"].(string); ok {
return m.rsaKeys[kid], nil
}
diff --git a/pkg/model/request/request.go b/pkg/model/request/request.go
index 1a4c0fa..12e1a94 100644
--- a/pkg/model/request/request.go
+++ b/pkg/model/request/request.go
@@ -90,7 +90,7 @@ type BuildStatusUpdate struct {
// BuildInputs is a key-value object of input variables used when starting a new
// build, where the key is the input variable name and the value is its string,
// boolean, or numeric value.
-type BuildInputs map[string]interface{}
+type BuildInputs map[string]any
// Project specifies fields when creating a new project.
type Project struct {
diff --git a/pkg/model/response/response.go b/pkg/model/response/response.go
index f0dd5a8..7b082c2 100644
--- a/pkg/model/response/response.go
+++ b/pkg/model/response/response.go
@@ -253,19 +253,19 @@ var ProjectJSONFields = struct {
// Project holds details about a project.
type Project struct {
TimeMetadata
- ProjectID uint `json:"projectId" minimum:"0"`
- RemoteProjectID string `json:"remoteProjectId"`
- Name string `json:"name"`
- GroupName string `json:"groupName"`
- Description string `json:"description"`
- AvatarURL string `json:"avatarUrl"`
- TokenID uint `json:"tokenId" minimum:"0"`
- ProviderID uint `json:"providerId" minimum:"0"`
- Provider *Provider `json:"provider" extensions:"x-nullable"`
- BuildDefinition string `json:"buildDefinition"`
- Branches []Branch `json:"branches"`
- GitURL string `json:"gitUrl"`
- ParsedBuildDefinition interface{} `json:"build" swaggertype:"object" extensions:"x-nullable"`
+ ProjectID uint `json:"projectId" minimum:"0"`
+ RemoteProjectID string `json:"remoteProjectId"`
+ Name string `json:"name"`
+ GroupName string `json:"groupName"`
+ Description string `json:"description"`
+ AvatarURL string `json:"avatarUrl"`
+ TokenID uint `json:"tokenId" minimum:"0"`
+ ProviderID uint `json:"providerId" minimum:"0"`
+ Provider *Provider `json:"provider" extensions:"x-nullable"`
+ BuildDefinition string `json:"buildDefinition"`
+ Branches []Branch `json:"branches"`
+ GitURL string `json:"gitUrl"`
+ ParsedBuildDefinition any `json:"build" swaggertype:"object" extensions:"x-nullable"`
}
// ProjectOverrides holds field overrides for a project.
diff --git a/pkg/modelconv/projectconv.go b/pkg/modelconv/projectconv.go
index b516214..d3e9777 100644
--- a/pkg/modelconv/projectconv.go
+++ b/pkg/modelconv/projectconv.go
@@ -68,11 +68,11 @@ func ReqProjectToDatabase(reqProject request.Project) database.Project {
// ParseBuildDefinition parses a YAML-formatted build definition string to be
// used in a project response.
-func ParseBuildDefinition(buildDef string) (interface{}, error) {
+func ParseBuildDefinition(buildDef string) (any, error) {
if buildDef == "" {
return nil, nil
}
- var parsed interface{}
+ var parsed any
err := yaml.Unmarshal([]byte(buildDef), &parsed)
if err != nil {
return nil, err
diff --git a/pkg/modelconv/projectconv_test.go b/pkg/modelconv/projectconv_test.go
index b8806b7..e1bf537 100644
--- a/pkg/modelconv/projectconv_test.go
+++ b/pkg/modelconv/projectconv_test.go
@@ -11,7 +11,7 @@ func TestDBProjectToResponseBuildDefParsing(t *testing.T) {
var testCases = []struct {
name string
dbProject database.Project
- want interface{}
+ want any
}{
{
name: "no build def",
@@ -21,7 +21,7 @@ func TestDBProjectToResponseBuildDefParsing(t *testing.T) {
{
name: "with build def",
dbProject: database.Project{BuildDefinition: "myStage: moo"},
- want: map[string]interface{}{
+ want: map[string]any{
"myStage": "moo",
},
},
diff --git a/utils.go b/utils.go
index 561cbcb..fbeb349 100644
--- a/utils.go
+++ b/utils.go
@@ -23,8 +23,8 @@ func findDefaultBranch(branches []database.Branch) (database.Branch, bool) {
return database.Branch{}, false
}
-func stringSliceToInterfaces(values []string) []interface{} {
- newSlice := make([]interface{}, len(values))
+func stringSliceToInterfaces(values []string) []any {
+ newSlice := make([]any, len(values))
for i, v := range values {
newSlice[i] = v
}
diff --git a/utils_gin.go b/utils_gin.go
index 087973b..41b54ce 100644
--- a/utils_gin.go
+++ b/utils_gin.go
@@ -23,7 +23,7 @@ var defaultCommonGetQueryParams = commonGetQueryParams{
Offset: 0,
}
-func bindCommonGetQueryParams(c *gin.Context, params interface{}) bool {
+func bindCommonGetQueryParams(c *gin.Context, params any) bool {
if err := c.ShouldBindQuery(params); err != nil {
ginutil.WriteInvalidBindError(c, err, "One or more parameters failed to parse when reading query parameters.")
return false
@@ -44,7 +44,7 @@ func parseCommonOrderBySlice(c *gin.Context, orders []string, fieldToColumnNames
return orderBySlice, true
}
-func renderJSON(c *gin.Context, code int, response interface{}) {
+func renderJSON(c *gin.Context, code int, response any) {
if shouldIndentJSONResponse(c) {
c.IndentedJSON(code, response)
} else {
diff --git a/utils_gorm.go b/utils_gorm.go
index c7f6100..5e7831c 100644
--- a/utils_gorm.go
+++ b/utils_gorm.go
@@ -13,7 +13,7 @@ import (
"gorm.io/gorm/clause"
)
-func findDBPaginatedSliceAndTotalCount(dbQuery *gorm.DB, limit, offset int, slicePtr interface{}, totalCount *int64) error {
+func findDBPaginatedSliceAndTotalCount(dbQuery *gorm.DB, limit, offset int, slicePtr any, totalCount *int64) error {
err := dbQuery.Scopes(optionalLimitOffsetScope(limit, offset)).Find(slicePtr).Error
if err != nil {
return err
@@ -22,7 +22,7 @@ func findDBPaginatedSliceAndTotalCount(dbQuery *gorm.DB, limit, offset int, slic
return dbQuery.Count(totalCount).Error
}
-func fetchDatabaseObjByID(c *gin.Context, db *gorm.DB, modelPtr interface{}, id uint, name, whenMsg string) bool {
+func fetchDatabaseObjByID(c *gin.Context, db *gorm.DB, modelPtr any, id uint, name, whenMsg string) bool {
if err := db.First(modelPtr, id).Error; err != nil {
if errors.Is(err, gorm.ErrRecordNotFound) {
writeDBFetchObjByIDNotFoundProblem(c, id, name, whenMsg)
@@ -34,7 +34,7 @@ func fetchDatabaseObjByID(c *gin.Context, db *gorm.DB, modelPtr interface{}, id
return true
}
-func validateDatabaseObjExistsByID(c *gin.Context, db *gorm.DB, modelPtr interface{}, id uint, name, whenMsg string) bool {
+func validateDatabaseObjExistsByID(c *gin.Context, db *gorm.DB, modelPtr any, id uint, name, whenMsg string) bool {
var count int64
if err := db.Model(modelPtr).Where(id).Count(&count).Error; err != nil {
writeDBFetchObjByIDErrorProblem(c, err, id, name, whenMsg)
@@ -179,7 +179,7 @@ func (b gormClauseBuilder) likeExpr(key database.SafeSQLName, value *string) cla
}
return clause.Expr{
SQL: sqlString,
- Vars: []interface{}{newLikeContainsValue(*value)},
+ Vars: []any{newLikeContainsValue(*value)},
}
}