Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to Go 1.22 #142

Merged
merged 1 commit into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
name: Build
runs-on: ubuntu-latest
container:
image: golang:1.21-alpine
image: golang:1.22-alpine
env:
GOFLAGS: -buildvcs=false
TEST_REDIS_HOST: redis
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ lint:

go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
golangci-lint run -E bidichk,durationcheck,errname,exportloopref \
-E forcetypeassert,godot,goerr113,gofumpt,gosec,nlreturn,prealloc \
-E protogetter,testifylint,unconvert,unparam,usestdlibvars \
-E forcetypeassert,godot,goerr113,gofumpt,gosec,nlreturn,perfsprint \
-E prealloc,protogetter,testifylint,unconvert,unparam,usestdlibvars \
--exclude-use-default=false

go install golang.org/x/vuln/cmd/govulncheck@latest
Expand Down
2 changes: 1 addition & 1 deletion build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# docker buildx build -f build/Dockerfile -t ghcr.io/ownmfa/hermes:${TAG} --push .
# docker buildx rm
# docker logout ghcr.io
FROM golang:1.21-alpine AS build
FROM golang:1.22-alpine AS build

# Add packages needed to support builds and tests
RUN apk update && apk upgrade
Expand Down
20 changes: 10 additions & 10 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
module github.com/ownmfa/hermes

go 1.21.6
go 1.22.0

require (
github.com/NYTimes/gziphandler v1.1.1
github.com/google/uuid v1.6.0
github.com/gregdel/pushover v1.3.0
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0
github.com/jackc/pgx/v5 v5.5.2
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1
github.com/jackc/pgx/v5 v5.5.3
github.com/jellydator/ttlcache/v3 v3.1.1
github.com/mennanov/fmutils v0.2.1
github.com/nsqio/go-nsq v1.1.0
github.com/ownmfa/proto/go v1.1.1
github.com/ownmfa/proto/go v1.1.2
github.com/redis/go-redis/v9 v9.4.0
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e
github.com/smira/go-statsd v1.3.3
github.com/stretchr/testify v1.8.4
go.uber.org/mock v0.4.0
golang.org/x/crypto v0.18.0
golang.org/x/crypto v0.19.0
google.golang.org/grpc v1.61.0
google.golang.org/protobuf v1.32.0
)
Expand All @@ -34,12 +34,12 @@ require (
github.com/jackc/puddle/v2 v2.2.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rogpeppe/go-internal v1.12.0 // indirect
golang.org/x/net v0.20.0 // indirect
golang.org/x/net v0.21.0 // indirect
golang.org/x/sync v0.6.0 // indirect
golang.org/x/sys v0.16.0 // indirect
golang.org/x/sys v0.17.0 // indirect
golang.org/x/text v0.14.0 // indirect
google.golang.org/genproto v0.0.0-20240123012728-ef4313101c80 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240123012728-ef4313101c80 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80 // indirect
google.golang.org/genproto v0.0.0-20240205150955-31a09d347014 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240205150955-31a09d347014 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240205150955-31a09d347014 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
36 changes: 18 additions & 18 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -522,8 +522,8 @@ github.com/googleapis/go-type-adapters v1.0.0/go.mod h1:zHW75FOG2aur7gAO2B+MLby+
github.com/gregdel/pushover v1.3.0 h1:CewbxqsThoN/1imgwkDKFkRkltaQMoyBV0K9IquQLtw=
github.com/gregdel/pushover v1.3.0/go.mod h1:EcaO66Nn1StkpEm1iKtBTV3d2A16SoMsVER1PthX7to=
github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0 h1:Wqo399gCIufwto+VfwCSvsnfGpF/w5E9CNxSwbpD6No=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0/go.mod h1:qmOFXW2epJhM0qSnUUYpldc7gVz2KMQwJ/QYCDIa7XU=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1 h1:/c3QmbOGMGTOumP2iT/rCwB7b0QDGLKzqOmktBjT+Is=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1/go.mod h1:5SN9VR2LTsRFsrEC6FHgRbTWrTHu6tqPeKxEQv15giM=
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
Expand All @@ -532,8 +532,8 @@ github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsI
github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg=
github.com/jackc/pgservicefile v0.0.0-20231201235250-de7065d80cb9 h1:L0QtFUgDarD7Fpv9jeVMgy/+Ec0mtnmYuImjTz6dtDA=
github.com/jackc/pgservicefile v0.0.0-20231201235250-de7065d80cb9/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM=
github.com/jackc/pgx/v5 v5.5.2 h1:iLlpgp4Cp/gC9Xuscl7lFL1PhhW+ZLtXZcrfCt4C3tA=
github.com/jackc/pgx/v5 v5.5.2/go.mod h1:ez9gk+OAat140fv9ErkZDYFWmXLfV+++K0uAOiwgm1A=
github.com/jackc/pgx/v5 v5.5.3 h1:Ces6/M3wbDXYpM8JyyPD57ivTtJACFZJd885pdIaV2s=
github.com/jackc/pgx/v5 v5.5.3/go.mod h1:ez9gk+OAat140fv9ErkZDYFWmXLfV+++K0uAOiwgm1A=
github.com/jackc/puddle/v2 v2.2.1 h1:RhxXJtFG022u4ibrCSMSiu5aOq1i77R3OHKNJj77OAk=
github.com/jackc/puddle/v2 v2.2.1/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4=
github.com/jellydator/ttlcache/v3 v3.1.1 h1:RCgYJqo3jgvhl+fEWvjNW8thxGWsgxi+TPhRir1Y9y8=
Expand All @@ -552,8 +552,8 @@ github.com/mennanov/fmutils v0.2.1 h1:AUxeJv4o92vKbZaM4RBLZ/i8WzPF/UISTNeXB3gEIl
github.com/mennanov/fmutils v0.2.1/go.mod h1:ph1jsu8gV1gUgMURCmfIVbXKG3O2/O5o/UbPbbqu8zs=
github.com/nsqio/go-nsq v1.1.0 h1:PQg+xxiUjA7V+TLdXw7nVrJ5Jbl3sN86EhGCQj4+FYE=
github.com/nsqio/go-nsq v1.1.0/go.mod h1:vKq36oyeVXgsS5Q8YEO7WghqidAVXQlcFxzQbQTuDEY=
github.com/ownmfa/proto/go v1.1.1 h1:QjGm9ZoVDsHoAysiZdciSu6COZzkG4NHLW2ND92/Pdo=
github.com/ownmfa/proto/go v1.1.1/go.mod h1:iRbUFEYAV6fxhf9UGGR0fbI70V88ezNa7/0yJ/7pp84=
github.com/ownmfa/proto/go v1.1.2 h1:sKw3TqP4E5BeCfdCumsF1cBe7K9Sw9Slq+lq6Zdn2rA=
github.com/ownmfa/proto/go v1.1.2/go.mod h1:9+2QP5peqzs3yE5NWUviHtfZV3WGTREI4tzi8J3ksG4=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
Expand Down Expand Up @@ -606,8 +606,8 @@ golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8U
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc=
golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg=
golang.org/x/crypto v0.19.0 h1:ENy+Az/9Y1vSrlrvBSyna3PITt4tiZLf7sgCjZBX7Wo=
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
Expand Down Expand Up @@ -691,8 +691,8 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug
golang.org/x/net v0.0.0-20220909164309-bea034e7d591/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk=
golang.org/x/net v0.0.0-20221012135044-0b7e1fb9d458/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk=
golang.org/x/net v0.0.0-20221014081412-f15817d10f9b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk=
golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo=
golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY=
golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4=
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
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=
Expand Down Expand Up @@ -797,8 +797,8 @@ golang.org/x/sys v0.0.0-20220615213510-4f61da869c0c/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220624220833-87e55d714810/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU=
golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y=
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
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=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand Down Expand Up @@ -1045,12 +1045,12 @@ google.golang.org/genproto v0.0.0-20221117204609-8f9c96812029/go.mod h1:rZS5c/ZV
google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6/go.mod h1:rZS5c/ZVYMaOGBfO68GWtjOw/eLaZM1X6iVtgjZ+EWg=
google.golang.org/genproto v0.0.0-20221201164419-0e50fba7f41c/go.mod h1:rZS5c/ZVYMaOGBfO68GWtjOw/eLaZM1X6iVtgjZ+EWg=
google.golang.org/genproto v0.0.0-20230202175211-008b39050e57/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM=
google.golang.org/genproto v0.0.0-20240123012728-ef4313101c80 h1:KAeGQVN3M9nD0/bQXnr/ClcEMJ968gUXJQ9pwfSynuQ=
google.golang.org/genproto v0.0.0-20240123012728-ef4313101c80/go.mod h1:cc8bqMqtv9gMOr0zHg2Vzff5ULhhL2IXP4sbcn32Dro=
google.golang.org/genproto/googleapis/api v0.0.0-20240123012728-ef4313101c80 h1:Lj5rbfG876hIAYFjqiJnPHfhXbv+nzTWfm04Fg/XSVU=
google.golang.org/genproto/googleapis/api v0.0.0-20240123012728-ef4313101c80/go.mod h1:4jWUdICTdgc3Ibxmr8nAJiiLHwQBY0UI0XZcEMaFKaA=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80 h1:AjyfHzEPEFp/NpvfN5g+KDla3EMojjhRVZc1i7cj+oM=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80/go.mod h1:PAREbraiVEVGVdTZsVWjSbbTtSyGbAgIIvni8a8CD5s=
google.golang.org/genproto v0.0.0-20240205150955-31a09d347014 h1:g/4bk7P6TPMkAUbUhquq98xey1slwvuVJPosdBqYJlU=
google.golang.org/genproto v0.0.0-20240205150955-31a09d347014/go.mod h1:xEgQu1e4stdSSsxPDK8Azkrk/ECl5HvdPf6nbZrTS5M=
google.golang.org/genproto/googleapis/api v0.0.0-20240205150955-31a09d347014 h1:x9PwdEgd11LgK+orcck69WVRo7DezSO4VUMPI4xpc8A=
google.golang.org/genproto/googleapis/api v0.0.0-20240205150955-31a09d347014/go.mod h1:rbHMSEDyoYX62nRVLOCc4Qt1HbsdytAYoVwgjiOhF3I=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240205150955-31a09d347014 h1:FSL3lRCkhaPFxqi0s9o+V4UI2WTzAVOvkgbd4kVV4Wg=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240205150955-31a09d347014/go.mod h1:SaPjaZGWb0lPqs6Ittu0spdfrOArqji4ZdeP5IC/9N4=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
Expand Down
2 changes: 1 addition & 1 deletion internal/hermes-api/interceptor/auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ func TestAuth(t *testing.T) {
metadata.Pairs(lTest.inpMD...))
}

handler := func(ctx context.Context, req interface{}) (
handler := func(_ context.Context, req interface{}) (
interface{}, error,
) {
return req, lTest.inpHandlerErr
Expand Down
2 changes: 1 addition & 1 deletion internal/hermes-api/interceptor/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func Log(skipPaths map[string]struct{}) grpc.UnaryServerInterceptor {
} else {
respOut := fmt.Sprintf("%+v", resp)
if len(respOut) > 80 {
respOut = fmt.Sprintf("%s...", respOut[:77])
respOut = respOut[:77] + "..."
}

logger.Info(respOut)
Expand Down
4 changes: 1 addition & 3 deletions internal/hermes-api/interceptor/log_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,7 @@ func TestLog(t *testing.T) {
ctx = metadata.NewIncomingContext(ctx,
metadata.Pairs(lTest.inpMD...))

handler := func(ctx context.Context, req interface{}) (
interface{}, error,
) {
handler := func(_ context.Context, req any) (any, error) {
return req, lTest.inpHandlerErr
}

Expand Down
6 changes: 2 additions & 4 deletions internal/hermes-api/interceptor/validate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func TestValidate(t *testing.T) {
tests := []struct {
err error
inpSkipPaths map[string]struct{}
inpReq interface{}
inpReq any
inpInfo *grpc.UnaryServerInfo
}{
{
Expand Down Expand Up @@ -63,9 +63,7 @@ func TestValidate(t *testing.T) {
testTimeout)
defer cancel()

handler := func(ctx context.Context, req interface{}) (
interface{}, error,
) {
handler := func(_ context.Context, _ any) (any, error) {
return nil, lTest.err
}

Expand Down
14 changes: 4 additions & 10 deletions internal/hermes-notifier/notifier/notify_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func TestNotifyMessages(t *testing.T) {

eventer := NewMockeventer(ctrl)
eventer.EXPECT().Create(gomock.Any(), gomock.Any()).
DoAndReturn(func(ctx interface{}, event interface{}) error {
DoAndReturn(func(_ any, _ any) error {
defer wg.Done()

return nil
Expand Down Expand Up @@ -296,19 +296,15 @@ func TestNotifyMessagesError(t *testing.T) {
notifier := notify.NewMockNotifier(ctrl)
notifier.EXPECT().SMS(gomock.Any(),
smsIdentity.GetSmsMethod().GetPhone(), app.GetDisplayName(), "861821").
DoAndReturn(func(
ctx interface{}, phone interface{}, displayName interface{},
passcode interface{},
) error {
DoAndReturn(func(_ any, _ any, _ any, _ any) error {
defer wg.Done()

return lTest.inpSMSErr
}).Times(lTest.inpSMSTimes)
notifier.EXPECT().Pushover(gomock.Any(),
pushoverIdentity.GetPushoverMethod().GetPushoverKey(),
app.GetDisplayName(), "861821").DoAndReturn(func(
ctx interface{}, userKey interface{}, displayName interface{},
passcode interface{},
_ any, _ any, _ any, _ any,
) error {
defer wg.Done()

Expand All @@ -317,9 +313,7 @@ func TestNotifyMessagesError(t *testing.T) {
notifier.EXPECT().Email(gomock.Any(), app.GetDisplayName(), app.GetEmail(),
emailIdentity.GetEmailMethod().GetEmail(), gomock.Any(),
gomock.Any(), gomock.Any()).DoAndReturn(func(
ctx interface{}, displayName interface{}, from interface{},
to interface{}, subject interface{}, body interface{},
htmlBody interface{},
_ any, _ any, _ any, _ any, _ any, _ any, _ any,
) error {
defer wg.Done()

Expand Down
20 changes: 9 additions & 11 deletions pkg/crypto/password_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,18 @@ func TestHashPass(t *testing.T) {
t.Parallel()

pass := random.String(10)
hashChan := make(chan []byte)

for i := 0; i < 2; i++ {
go func() {
h, err := HashPass(pass)
t.Logf("h, err: %s, %v", h, err)
require.NoError(t, err)
require.Len(t, h, 60)
h1, err := HashPass(pass)
t.Logf("h1, err: %s, %v", h1, err)
require.NoError(t, err)
require.Len(t, h1, 60)

hashChan <- h
}()
}
h2, err := HashPass(pass)
t.Logf("h2, err: %s, %v", h2, err)
require.NoError(t, err)
require.Len(t, h2, 60)

require.NotEqual(t, <-hashChan, <-hashChan)
require.NotEqual(t, h1, h2)
}

func TestCompareHashPass(t *testing.T) {
Expand Down
4 changes: 1 addition & 3 deletions pkg/dao/org/key.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package org

import "fmt"

// orgKey returns a cache key by organization ID.
func orgKey(orgID string) string {
return fmt.Sprintf("dao:org:%s", orgID)
return "dao:org:" + orgID
}
2 changes: 1 addition & 1 deletion pkg/dao/org/key_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func TestOrgKey(t *testing.T) {
key := orgKey(orgID)
t.Logf("key: %v", key)

require.Equal(t, fmt.Sprintf("dao:org:%s", orgID), key)
require.Equal(t, "dao:org:"+orgID, key)
require.Equal(t, key, orgKey(orgID))
})
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/dao/pg_db_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func TestNewPgDB(t *testing.T) {
// Bad URI.
{"://", "missing protocol scheme"},
// Database does not exist.
{fmt.Sprintf("%s_not_exist", testConfig.PgURI), "does not exist"},
{testConfig.PgURI + "_not_exist", "does not exist"},
// Wrong port.
{"postgres://127.0.0.1:5433/db", "connect: connection refused"},
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/hlog/slog.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func parseLevel(level string) slog.Level {
slevel, ok := levels[strings.ToUpper(level)]
if !ok {
slog.LogAttrs(context.Background(), slog.LevelError,
fmt.Sprintf("parseLevel unknown level, using INFO: %s", level))
"parseLevel unknown level, using INFO: "+level)
slevel = slog.LevelInfo
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/notify/pushover.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ func (n *notify) pushover(

// Truncate to subject and body limits: https://pushover.net/api#limits
if len(subject) > 250 {
subject = fmt.Sprintf("%s...", subject[:247])
subject = subject[:247] + "..."
}
if len(body) > 1024 {
body = fmt.Sprintf("%s...", body[:1024])
body = body[:1024] + "..."
}
msg := pushover.NewMessageWithTitle(body, subject)

Expand Down
2 changes: 1 addition & 1 deletion proto/go/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.21-alpine
FROM golang:1.22-alpine

RUN apk update && apk upgrade
RUN apk add --no-cache make protobuf protobuf-dev git
Expand Down

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

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

Loading
Loading