From 407f2db8b2b3f2e5a15150a5897fa1cc422e3c99 Mon Sep 17 00:00:00 2001 From: Sarah Roberts Date: Mon, 11 Mar 2024 18:06:52 -0700 Subject: [PATCH 1/3] DD-18: switched to Go version 1.21 --- Dockerfile | 2 +- bags.go | 8 ++--- go.mod | 33 +++++++++++++++----- go.sum | 82 -------------------------------------------------- preferences.go | 10 +++--- searches.go | 4 +-- sessions.go | 30 +++++++++--------- 7 files changed, 52 insertions(+), 117 deletions(-) diff --git a/Dockerfile b/Dockerfile index 334fd75..5d4e464 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.17 +FROM golang:1.21 WORKDIR /build diff --git a/bags.go b/bags.go index 75a2c42..9da059a 100644 --- a/bags.go +++ b/bags.go @@ -6,7 +6,7 @@ import ( "encoding/json" "errors" "fmt" - "io/ioutil" + "io" "net/http" "strings" @@ -216,7 +216,7 @@ func (b *BagsApp) AddBag(writer http.ResponseWriter, request *http.Request) { http.Error(writer, err.Error(), status) } - if body, err = ioutil.ReadAll(request.Body); err != nil { + if body, err = io.ReadAll(request.Body); err != nil { errored(writer, fmt.Sprintf("error reading body: %s", err)) return } @@ -274,7 +274,7 @@ func (b *BagsApp) UpdateBag(writer http.ResponseWriter, request *http.Request) { return } - if body, err = ioutil.ReadAll(request.Body); err != nil { + if body, err = io.ReadAll(request.Body); err != nil { errored(writer, fmt.Sprintf("error reading body: %s", err)) return } @@ -307,7 +307,7 @@ func (b *BagsApp) UpdateDefaultBag(writer http.ResponseWriter, request *http.Req http.Error(writer, err.Error(), status) } - if body, err = ioutil.ReadAll(request.Body); err != nil { + if body, err = io.ReadAll(request.Body); err != nil { errored(writer, fmt.Sprintf("error reading body: %s", err)) return } diff --git a/go.mod b/go.mod index 7596222..3a75cf2 100644 --- a/go.mod +++ b/go.mod @@ -1,30 +1,47 @@ module github.com/cyverse-de/user-info -go 1.13 +go 1.21 require ( - github.com/BurntSushi/toml v1.0.0 // indirect github.com/DATA-DOG/go-sqlmock v1.3.0 github.com/cyverse-de/configurate v0.0.0-20171005230251-9b512d37328e github.com/cyverse-de/dbutil v1.0.1 github.com/cyverse-de/go-mod/otelutils v0.0.2 github.com/cyverse-de/queries v1.0.1 github.com/gorilla/mux v1.8.0 - github.com/hashicorp/hcl v0.0.0-20171017181929-23c074d0eceb // indirect github.com/lib/pq v1.10.4 + github.com/sirupsen/logrus v1.0.5-0.20180129181852-768a92a02685 + github.com/spf13/viper v1.0.0 + go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux v0.30.0 +) + +require ( + github.com/BurntSushi/toml v1.0.0 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/felixge/httpsnoop v1.0.2 // indirect + github.com/fsnotify/fsnotify v1.4.9 // indirect + github.com/go-logr/logr v1.2.3 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/google/uuid v1.3.0 // indirect + github.com/hashicorp/hcl v0.0.0-20171017181929-23c074d0eceb // indirect github.com/magiconair/properties v1.7.6 // indirect github.com/mitchellh/mapstructure v0.0.0-20180220230111-00c29f56e238 // indirect - github.com/onsi/ginkgo v1.16.5 // indirect - github.com/onsi/gomega v1.18.1 // indirect github.com/pelletier/go-toml v1.1.0 // indirect - github.com/sirupsen/logrus v1.0.5-0.20180129181852-768a92a02685 + github.com/pkg/errors v0.9.1 // indirect github.com/spf13/afero v1.0.2 // indirect github.com/spf13/cast v1.2.0 // indirect github.com/spf13/jwalterweatherman v0.0.0-20180109140146-7c0cea34c8ec // indirect github.com/spf13/pflag v1.0.0 // indirect - github.com/spf13/viper v1.0.0 github.com/uptrace/opentelemetry-go-extra/otelsql v0.1.11 // indirect - go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux v0.30.0 + go.opentelemetry.io/otel v1.6.1 // indirect + go.opentelemetry.io/otel/exporters/jaeger v1.6.1 // indirect + go.opentelemetry.io/otel/metric v0.28.0 // indirect + go.opentelemetry.io/otel/sdk v1.6.1 // indirect + go.opentelemetry.io/otel/trace v1.6.1 // indirect + golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 // indirect + golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect + golang.org/x/text v0.3.6 // indirect gopkg.in/airbrake/gobrake.v2 v2.0.9 // indirect gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect ) diff --git a/go.sum b/go.sum index d50610e..bb6c821 100644 --- a/go.sum +++ b/go.sum @@ -2,9 +2,6 @@ github.com/BurntSushi/toml v1.0.0 h1:dtDWrepsVPfW9H/4y7dDgFc2MBUSeJhlaDtK13CxFlU github.com/BurntSushi/toml v1.0.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/DATA-DOG/go-sqlmock v1.3.0 h1:ljjRxlddjfChBJdFKJs5LuCwCWPLaC1UZLwAo3PBBMk= github.com/DATA-DOG/go-sqlmock v1.3.0/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= -github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= -github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= -github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/cyverse-de/configurate v0.0.0-20171005230251-9b512d37328e h1:h6okcwNgr8hsFfd0hFdl8usV0AtdCQca4CNfpllCqxQ= github.com/cyverse-de/configurate v0.0.0-20171005230251-9b512d37328e/go.mod h1:QMZ4G8bX5f0vKiH9+/2JqV687mN1byJ18tjZwIJIagI= github.com/cyverse-de/dbutil v1.0.1 h1:aCfckMIIJcPGZw9kJ5a1sJSji03/swkCsC7iwD5cX9A= @@ -18,7 +15,6 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/felixge/httpsnoop v1.0.2 h1:+nS9g82KMXccJ/wp0zyRW9ZBHFETmMGtkk+2CTTrW4o= github.com/felixge/httpsnoop v1.0.2/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= @@ -26,53 +22,20 @@ github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= -github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= -github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= github.com/hashicorp/hcl v0.0.0-20171017181929-23c074d0eceb h1:1OvvPvZkn/yCQ3xBcM8y4020wdkMXPHLB4+NfoGWh4U= github.com/hashicorp/hcl v0.0.0-20171017181929-23c074d0eceb/go.mod h1:oZtUIOe8dh44I2q6ScRibXws4Ajl+d+nod3AaR9vL5w= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/lib/pq v1.10.4 h1:SO9z7FRPzA03QhHKJrH5BXA6HU1rS4V2nIVrrNC1iYk= github.com/lib/pq v1.10.4/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/magiconair/properties v1.7.6 h1:U+1DqNen04MdEPgFiIwdOUiqZ8qPa37xgogX/sd3+54= github.com/magiconair/properties v1.7.6/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/mitchellh/mapstructure v0.0.0-20180220230111-00c29f56e238 h1:+MZW2uvHgN8kYvksEN3f7eFL2wpzk0GxmlFsMybWc7E= github.com/mitchellh/mapstructure v0.0.0-20180220230111-00c29f56e238/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= -github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= -github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= -github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= -github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= -github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= -github.com/onsi/ginkgo/v2 v2.0.0 h1:CcuG/HvWNkkaqCUpJifQY8z7qEMBJya6aLPx6ftGyjQ= -github.com/onsi/ginkgo/v2 v2.0.0/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c= -github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= -github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= -github.com/onsi/gomega v1.18.1 h1:M1GfJqGRrBrrGGsbxzV5dqM2U2ApXefZCQpkukxYRLE= -github.com/onsi/gomega v1.18.1/go.mod h1:0q+aL8jAiMXy9hbwj2mr5GziHiwhAIQpFmmtT5hitRs= github.com/pelletier/go-toml v1.1.0 h1:cmiOvKzEunMsAxyhXSzpL5Q1CRKpVv0KQsnAIcSEVYM= github.com/pelletier/go-toml v1.1.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= @@ -93,14 +56,12 @@ github.com/spf13/viper v1.0.0 h1:RUA/ghS2i64rlnn4ydTfblY8Og8QzcPtCcHvgMn+w/I= github.com/spf13/viper v1.0.0/go.mod h1:A8kyI5cUJhb8N+3pkfONlcEcZbueH6nhAm0Fq7SrnBM= github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/uptrace/opentelemetry-go-extra/otelsql v0.1.10/go.mod h1:SVTZcEiaaEsE84gE7dYuteSc4oklkYHIFE4EBu+DiNQ= github.com/uptrace/opentelemetry-go-extra/otelsql v0.1.11 h1:pYfpYr+cLTrT/oTlWcRUyQxvlm1DoPBeXXF7NBybVzU= github.com/uptrace/opentelemetry-go-extra/otelsql v0.1.11/go.mod h1:9zxD67AHoV47IZw9w7Xl+9GsPkTrVUCFRRGiKTMqdjs= -github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux v0.30.0 h1:dMGQo/LYGcJJKLx2iNi5aH5JJxhEHdAvpchvpQ6d6qQ= go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux v0.30.0/go.mod h1:UzCb9KHNmmp3ACX2KQPo+0UmK+ylcF22ucDgAoV4n8I= go.opentelemetry.io/otel v1.4.0/go.mod h1:jeAqMFKy2uLIxCtKxoFj0FAL5zAPKQagc3+GtBWakzk= @@ -124,69 +85,26 @@ go.opentelemetry.io/otel/trace v1.6.0/go.mod h1:qs7BrU5cZ8dXQHBGxHMOxwME/27YH2qE go.opentelemetry.io/otel/trace v1.6.1 h1:f8c93l5tboBYZna1nWk0W9DYyMzJXDWdZcJZ0Kb400U= go.opentelemetry.io/otel/trace v1.6.1/go.mod h1:RkFRM1m0puWIq10oxImnGEduNBzxiN7TXluRBtE+5j0= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20210428140749-89ef3d95e781 h1:DzZ89McO9/gWPsQXS/FVKAlG02ZjaQ6AlZRBimEYOd0= -golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -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= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= gopkg.in/airbrake/gobrake.v2 v2.0.9 h1:7z2uVWwn7oVeeugY1DtlPAy5H+KYgB1KeKTnqjNatLo= gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2 h1:OAj3g0cR6Dx/R07QgQe8wkA9RNjB2u4i700xBkIT4e0= gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2/go.mod h1:Xk6kEKp8OKb+X14hQBKWaSkCsqBpgog8nAV2xsGOxlo= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= diff --git a/preferences.go b/preferences.go index e7a5c4d..c574910 100644 --- a/preferences.go +++ b/preferences.go @@ -4,7 +4,7 @@ import ( "context" "encoding/json" "fmt" - "io/ioutil" + "io" "net/http" "github.com/gorilla/mux" @@ -80,7 +80,7 @@ func (u *UserPreferencesApp) getUserPreferencesForRequest(ctx context.Context, u prefs, err := u.prefs.getPreferences(ctx, username) if err != nil { - return nil, fmt.Errorf("Error getting preferences for username %s: %s", username, err) + return nil, fmt.Errorf("error getting preferences for username %s: %s", username, err) } if len(prefs) >= 1 { @@ -89,14 +89,14 @@ func (u *UserPreferencesApp) getUserPreferencesForRequest(ctx context.Context, u response, err := convertPrefs(&retval, wrap) if err != nil { - return nil, fmt.Errorf("Error generating response for username %s: %s", username, err) + return nil, fmt.Errorf("error generating response for username %s: %s", username, err) } var jsoned []byte if len(response) > 0 { jsoned, err = json.Marshal(response) if err != nil { - return nil, fmt.Errorf("Error generating preferences JSON for user %s: %s", username, err) + return nil, fmt.Errorf("error generating preferences JSON for user %s: %s", username, err) } } else { jsoned = []byte("{}") @@ -180,7 +180,7 @@ func (u *UserPreferencesApp) PostRequest(writer http.ResponseWriter, r *http.Req } var checked map[string]interface{} - bodyBuffer, err := ioutil.ReadAll(r.Body) + bodyBuffer, err := io.ReadAll(r.Body) if err != nil { errored(writer, fmt.Sprintf("Error reading body: %s", err)) return diff --git a/searches.go b/searches.go index 68745d1..be4314e 100644 --- a/searches.go +++ b/searches.go @@ -4,7 +4,7 @@ import ( "context" "encoding/json" "fmt" - "io/ioutil" + "io" "net/http" "github.com/gorilla/mux" @@ -99,7 +99,7 @@ func (s *SavedSearchesApp) PostRequest(writer http.ResponseWriter, r *http.Reque return } - bodyBuffer, err := ioutil.ReadAll(r.Body) + bodyBuffer, err := io.ReadAll(r.Body) if err != nil { errored(writer, fmt.Sprintf("Error reading body: %s", err)) return diff --git a/sessions.go b/sessions.go index 55812fd..b9abffc 100644 --- a/sessions.go +++ b/sessions.go @@ -4,7 +4,7 @@ import ( "context" "encoding/json" "fmt" - "io/ioutil" + "io" "net/http" "github.com/gorilla/mux" @@ -40,7 +40,7 @@ func (u *UserSessionsApp) Greeting(writer http.ResponseWriter, r *http.Request) func (u *UserSessionsApp) getUserSessionForRequest(ctx context.Context, username string, wrap bool) ([]byte, error) { sessions, err := u.sessions.getSessions(ctx, username) if err != nil { - return nil, fmt.Errorf("Error getting sessions for username %s: %s", username, err) + return nil, fmt.Errorf("error getting sessions for username %s: %s", username, err) } var retval UserSessionRecord @@ -50,14 +50,14 @@ func (u *UserSessionsApp) getUserSessionForRequest(ctx context.Context, username response, err := convertSessions(&retval, wrap) if err != nil { - return nil, fmt.Errorf("Error generating response for username %s: %s", username, err) + return nil, fmt.Errorf("error generating response for username %s: %s", username, err) } var jsoned []byte if len(response) > 0 { jsoned, err = json.Marshal(response) if err != nil { - return nil, fmt.Errorf("Error generating session JSON for user %s: %s", username, err) + return nil, fmt.Errorf("error generating session JSON for user %s: %s", username, err) } } else { jsoned = []byte("{}") @@ -86,7 +86,7 @@ func (u *UserSessionsApp) GetRequest(writer http.ResponseWriter, r *http.Request "service": "sessions", }).Info("Getting user session for ", username) if userExists, err = u.sessions.isUser(ctx, username); err != nil { - badRequest(writer, fmt.Sprintf("Error checking for username %s: %s", username, err)) + badRequest(writer, fmt.Sprintf("error checking for username %s: %s", username, err)) return } @@ -126,7 +126,7 @@ func (u *UserSessionsApp) PostRequest(writer http.ResponseWriter, r *http.Reques } if userExists, err = u.sessions.isUser(ctx, username); err != nil { - badRequest(writer, fmt.Sprintf("Error checking for username %s: %s", username, err)) + badRequest(writer, fmt.Sprintf("error checking for username %s: %s", username, err)) return } @@ -136,31 +136,31 @@ func (u *UserSessionsApp) PostRequest(writer http.ResponseWriter, r *http.Reques } if hasSession, err = u.sessions.hasSessions(ctx, username); err != nil { - errored(writer, fmt.Sprintf("Error checking session for user %s: %s", username, err)) + errored(writer, fmt.Sprintf("error checking session for user %s: %s", username, err)) return } var checked map[string]interface{} - bodyBuffer, err := ioutil.ReadAll(r.Body) + bodyBuffer, err := io.ReadAll(r.Body) if err != nil { - errored(writer, fmt.Sprintf("Error reading body: %s", err)) + errored(writer, fmt.Sprintf("error reading body: %s", err)) return } if err = json.Unmarshal(bodyBuffer, &checked); err != nil { - errored(writer, fmt.Sprintf("Error parsing request body: %s", err)) + errored(writer, fmt.Sprintf("error parsing request body: %s", err)) return } bodyString := string(bodyBuffer) if !hasSession { if err = u.sessions.insertSession(ctx, username, bodyString); err != nil { - errored(writer, fmt.Sprintf("Error inserting session for user %s: %s", username, err)) + errored(writer, fmt.Sprintf("error inserting session for user %s: %s", username, err)) return } } else { if err = u.sessions.updateSession(ctx, username, bodyString); err != nil { - errored(writer, fmt.Sprintf("Error updating session for user %s: %s", username, err)) + errored(writer, fmt.Sprintf("error updating session for user %s: %s", username, err)) return } } @@ -192,7 +192,7 @@ func (u *UserSessionsApp) DeleteRequest(writer http.ResponseWriter, r *http.Requ } if userExists, err = u.sessions.isUser(ctx, username); err != nil { - badRequest(writer, fmt.Sprintf("Error checking for username %s: %s", username, err)) + badRequest(writer, fmt.Sprintf("error checking for username %s: %s", username, err)) return } @@ -202,7 +202,7 @@ func (u *UserSessionsApp) DeleteRequest(writer http.ResponseWriter, r *http.Requ } if hasSession, err = u.sessions.hasSessions(ctx, username); err != nil { - errored(writer, fmt.Sprintf("Error checking session for user %s: %s", username, err)) + errored(writer, fmt.Sprintf("error checking session for user %s: %s", username, err)) return } @@ -211,6 +211,6 @@ func (u *UserSessionsApp) DeleteRequest(writer http.ResponseWriter, r *http.Requ } if err = u.sessions.deleteSession(ctx, username); err != nil { - errored(writer, fmt.Sprintf("Error deleting session for user %s: %s", username, err)) + errored(writer, fmt.Sprintf("error deleting session for user %s: %s", username, err)) } } From 70b3c50ef698bef7e2821b8d0842b886d5142fa6 Mon Sep 17 00:00:00 2001 From: Sarah Roberts Date: Mon, 11 Mar 2024 18:08:24 -0700 Subject: [PATCH 2/3] DD-18: migrated to the shared GitHub workflows --- .github/workflows/build-prerelease.yml | 35 ------------------ .github/workflows/build-release.yml | 34 ------------------ .github/workflows/golangci-lint.yml | 50 +++----------------------- .github/workflows/skaffold-build.yml | 16 +++++++++ 4 files changed, 20 insertions(+), 115 deletions(-) delete mode 100644 .github/workflows/build-prerelease.yml delete mode 100644 .github/workflows/build-release.yml create mode 100644 .github/workflows/skaffold-build.yml diff --git a/.github/workflows/build-prerelease.yml b/.github/workflows/build-prerelease.yml deleted file mode 100644 index 8ba760d..0000000 --- a/.github/workflows/build-prerelease.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: skaffold-build-prerelease -on: - push: - tags: - - "v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+" -jobs: - pipeline: - name: Skaffold Docker build - runs-on: ubuntu-20.04 - steps: - - name: Checkout Repo - id: checkout - uses: actions/checkout@v3 - - name: Harbor Login - id: harbor_login - uses: docker/login-action@v2 - with: - registry: harbor.cyverse.org - username: ${{ secrets.HARBOR_USERNAME }} - password: ${{ secrets.HARBOR_PASSWORD }} - - name: Install Kubernetes Tools - id: install_k8s_tools - uses: yokawasa/action-setup-kube-tools@v0.9.2 - - name: Build Docker images - id: build - run: | - skaffold build --file-output build.json - - name: Build manifest tarball - id: build_manifest_tarball - run: | - tar -czpvf deploy-info.tar.gz build.json skaffold.yaml k8s - - uses: ncipollo/release-action@v1 - with: - artifacts: "build.json,deploy-info.tar.gz" - prerelease: true diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml deleted file mode 100644 index be07f90..0000000 --- a/.github/workflows/build-release.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: skaffold-build-release -on: - push: - tags: - - "v[0-9]+.[0-9]+.[0-9]+" -jobs: - pipeline: - name: Skaffold Docker build - runs-on: ubuntu-20.04 - steps: - - name: Checkout Repo - id: checkout - uses: actions/checkout@v3 - - name: Harbor Login - id: harbor_login - uses: docker/login-action@v2 - with: - registry: harbor.cyverse.org - username: ${{ secrets.HARBOR_USERNAME }} - password: ${{ secrets.HARBOR_PASSWORD }} - - name: Install Kubernetes Tools - id: install_k8s_tools - uses: yokawasa/action-setup-kube-tools@v0.9.2 - - name: Build Docker images - id: build - run: | - skaffold build --file-output build.json - - name: Build manifest tarball - id: build_manifest_tarball - run: | - tar -czpvf deploy-info.tar.gz build.json skaffold.yaml k8s - - uses: ncipollo/release-action@v1 - with: - artifacts: "build.json,deploy-info.tar.gz" diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index d2af3ec..ca4a48e 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -6,50 +6,8 @@ on: - main pull_request: -permissions: - contents: read - # Optional: allow read access to pull request. Use with `only-new-issues` option. - # pull-requests: read - jobs: - golangci: - name: lint - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v4 - with: - go-version: '1.19' - cache: false - - name: golangci-lint - uses: golangci/golangci-lint-action@v3 - with: - # Require: The version of golangci-lint to use. - # When `install-mode` is `binary` (default) the value can be v1.2 or v1.2.3 or `latest` to use the latest version. - # When `install-mode` is `goinstall` the value can be v1.2.3, `latest`, or the hash of a commit. - version: v1.53 - - # Optional: working directory, useful for monorepos - # working-directory: somedir - - # Optional: golangci-lint command line arguments. - # - # Note: by default the `.golangci.yml` file should be at the root of the repository. - # The location of the configuration file can be changed by using `--config=` - # args: --timeout=30m --config=/my/path/.golangci.yml --issues-exit-code=0 - - # Optional: show only new issues if it's a pull request. The default value is `false`. - # only-new-issues: true - - # Optional: if set to true then the all caching functionality will be complete disabled, - # takes precedence over all other caching options. - # skip-cache: true - - # Optional: if set to true then the action don't cache or restore ~/go/pkg. - # skip-pkg-cache: true - - # Optional: if set to true then the action don't cache or restore ~/.cache/go-build. - # skip-build-cache: true - - # Optional:The mode to install golangci-lint. It can be 'binary' or 'goinstall'. - # install-mode: "goinstall" + call-workflow-passing-data: + uses: cyverse-de/github-workflows/.github/workflows/golangci-lint.yml@v0.0.4 + with: + go-version: 1.21 diff --git a/.github/workflows/skaffold-build.yml b/.github/workflows/skaffold-build.yml new file mode 100644 index 0000000..2d57c99 --- /dev/null +++ b/.github/workflows/skaffold-build.yml @@ -0,0 +1,16 @@ +name: skaffold-build + +on: + push: + tags: + - "v[0-9]+.[0-9]+.[0-9]+" + - "v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+" + +jobs: + call-workflow-passing-data: + uses: cyverse-de/github-workflows/.github/workflows/skaffold-build.yml@v0.0.3 + with: + build-prerelease: ${{ contains(github.ref_name, '-rc') }} + secrets: + harbor-username: ${{ secrets.HARBOR_USERNAME }} + harbor-password: ${{ secrets.HARBOR_PASSWORD }} From f52ed40184985d35747c80f937b528f353d0492b Mon Sep 17 00:00:00 2001 From: Sarah Roberts Date: Mon, 11 Mar 2024 18:11:39 -0700 Subject: [PATCH 3/3] DD-17: added `ephemeral-storage` requests and limits --- k8s/user-info.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/k8s/user-info.yml b/k8s/user-info.yml index 3206c61..0e7e94a 100644 --- a/k8s/user-info.yml +++ b/k8s/user-info.yml @@ -46,9 +46,11 @@ spec: requests: cpu: "1m" memory: "128Mi" + ephemeral-storage: "1Gi" limits: cpu: "100m" memory: "256Mi" + ephemeral-storage: "1Gi" env: - name: OTEL_TRACES_EXPORTER valueFrom: