diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0e3691b9..eddddca9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,7 +26,7 @@ jobs: - name: Set up Go uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 with: - go-version: '1.20' + go-version: '1.22' - name: Run tests run: go test -v -skip TestPyPIArtifactsLive ./... @@ -39,7 +39,7 @@ jobs: - name: Set up Go uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 with: - go-version: '1.20' + go-version: '1.22' - name: Build run: make build diff --git a/.golangci.yml b/.golangci.yml index de24d4ca..884d6bd6 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -7,14 +7,14 @@ linters: enable: - asciicheck - bodyclose - - deadcode + - copyloopvar #- depguard - dogsled - dupl + - err113 - errcheck - errorlint - exhaustive - - exportloopref - gci - gochecknoinits - gocognit @@ -23,12 +23,10 @@ linters: - gocyclo - godot - godox - - goerr113 - gofmt - gofumpt - goheader - goimports - - golint # - gomnd - gomodguard - goprintffuncname @@ -36,10 +34,8 @@ linters: - gosimple - govet - ineffassign - - interfacer - lll - makezero - - maligned - misspell - nakedret - nestif @@ -47,11 +43,10 @@ linters: - paralleltest - prealloc - predeclared + - revive - rowserrcheck - - scopelint - sqlclosecheck - staticcheck - - structcheck - stylecheck - thelper - tparallel @@ -59,7 +54,6 @@ linters: - unconvert - unparam - unused - - varcheck - whitespace # - wrapcheck # - exhaustivestruct diff --git a/Dockerfile b/Dockerfile index add82627..86ecb950 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ # Originally modified from the main Cloud Run documentation -FROM golang:1.20.5-buster@sha256:eb3f9ac805435c1b2c965d63ce460988e1000058e1f67881324746362baf9572 as builder +FROM golang:1.22.6-bookworm@sha256:f020456572fc292e9627b3fb435c6de5dfb8020fbcef1fd7b65dd092c0ac56bb AS builder # Create and change to the app directory. WORKDIR /app diff --git a/Makefile b/Makefile index f56a3aa0..538b0fde 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ GO ?= go BIN := bin GOOS ?= $(shell uname | tr A-Z a-z) -GOLANGCI_LINT_VERSION = v1.53.3 +GOLANGCI_LINT_VERSION = v1.60.3 PROJECT := package-feeds .PHONY: help diff --git a/go.mod b/go.mod index 6dfd17db..04ed03ba 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/ossf/package-feeds -go 1.20 +go 1.22 require ( github.com/hashicorp/golang-lru/v2 v2.0.7 diff --git a/go.sum b/go.sum index 66f4fee9..b5c83881 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,6 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.112.1 h1:uJSeirPke5UNZHIb4SxfZklVSiWWVqW4oXlETwZziwM= +cloud.google.com/go v0.112.1/go.mod h1:+Vbu+Y1UU+I1rjmzeMOb/8RfkKJK2Gyxi1X6jJCZLo4= cloud.google.com/go/compute v1.25.0 h1:H1/4SqSUhjPFE7L5ddzHOfY2bCAvjwNRZPNl6Ni5oYU= cloud.google.com/go/compute v1.25.0/go.mod h1:GR7F0ZPZH8EhChlMo9FkLd7eUTwEymjqQagxzilIxIE= cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= @@ -12,19 +13,33 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/IBM/sarama v1.43.0 h1:YFFDn8mMI2QL0wOrG0J2sFoVIAFl7hS9JQi2YZsXtJc= github.com/IBM/sarama v1.43.0/go.mod h1:zlE6HEbC/SMQ9mhEYaF7nNLYOUyrs0obySKCckWP9BM= github.com/aws/aws-sdk-go v1.50.36 h1:PjWXHwZPuTLMR1NIb8nEjLucZBMzmf84TLoLbD8BZqk= +github.com/aws/aws-sdk-go v1.50.36/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk= github.com/aws/aws-sdk-go-v2 v1.25.3 h1:xYiLpZTQs1mzvz5PaI6uR0Wh57ippuEthxS4iK5v0n0= +github.com/aws/aws-sdk-go-v2 v1.25.3/go.mod h1:35hUlJVYd+M++iLI3ALmVwMOyRYMmRqUXpTtRGW+K9I= github.com/aws/aws-sdk-go-v2/config v1.27.7 h1:JSfb5nOQF01iOgxFI5OIKWwDiEXWTyTgg1Mm1mHi0A4= +github.com/aws/aws-sdk-go-v2/config v1.27.7/go.mod h1:PH0/cNpoMO+B04qET699o5W92Ca79fVtbUnvMIZro4I= github.com/aws/aws-sdk-go-v2/credentials v1.17.7 h1:WJd+ubWKoBeRh7A5iNMnxEOs982SyVKOJD+K8HIezu4= +github.com/aws/aws-sdk-go-v2/credentials v1.17.7/go.mod h1:UQi7LMR0Vhvs+44w5ec8Q+VS+cd10cjwgHwiVkE0YGU= github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.15.3 h1:p+y7FvkK2dxS+FEwRIDHDe//ZX+jDhP8HHE50ppj4iI= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.15.3/go.mod h1:/fYB+FZbDlwlAiynK9KDXlzZl3ANI9JkD0Uhz5FjNT4= github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.3 h1:ifbIbHZyGl1alsAhPIYsHOg5MuApgqOvVeI8wIugXfs= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.3/go.mod h1:oQZXg3c6SNeY6OZrDY+xHcF4VGIEoNotX2B4PrDeoJI= github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.3 h1:Qvodo9gHG9F3E8SfYOspPeBt0bjSbsevK8WhRAUHcoY= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.3/go.mod h1:vCKrdLXtybdf/uQd/YfVR2r5pcbNuEYKzMQpcxmeSJw= github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0 h1:hT8rVHwugYE2lEfdFE0QWVo81lF7jMrYJVDWI+f+VxU= +github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0/go.mod h1:8tu/lYfQfFe6IGnaOdrpVgEL2IrrDOf6/m9RQum4NkY= github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.1 h1:EyBZibRTVAs6ECHZOw5/wlylS9OcTzwyjeQMudmREjE= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.1/go.mod h1:JKpmtYhhPs7D97NL/ltqz7yCkERFW5dOlHyVl66ZYF8= github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.5 h1:K/NXvIftOlX+oGgWGIa3jDyYLDNsdVhsjHmsBH2GLAQ= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.5/go.mod h1:cl9HGLV66EnCmMNzq4sYOti+/xo8w34CsgzVtm2GgsY= github.com/aws/aws-sdk-go-v2/service/sso v1.20.2 h1:XOPfar83RIRPEzfihnp+U6udOveKZJvPQ76SKWrLRHc= +github.com/aws/aws-sdk-go-v2/service/sso v1.20.2/go.mod h1:Vv9Xyk1KMHXrR3vNQe8W5LMFdTjSeWk0gBZBzvf3Qa0= github.com/aws/aws-sdk-go-v2/service/ssooidc v1.23.2 h1:pi0Skl6mNl2w8qWZXcdOyg197Zsf4G97U7Sso9JXGZE= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.23.2/go.mod h1:JYzLoEVeLXk+L4tn1+rrkfhkxl6mLDEVaDSvGq9og90= github.com/aws/aws-sdk-go-v2/service/sts v1.28.4 h1:Ppup1nVNAOWbBOrcoOxaxPeEnSFB2RnnQdguhXpmeQk= +github.com/aws/aws-sdk-go-v2/service/sts v1.28.4/go.mod h1:+K1rNPVyGxkRuv9NNiaZ4YhBFuyw2MMA9SlIJ1Zlpz8= github.com/aws/smithy-go v1.20.1 h1:4SZlSlMr36UEqC7XOyRVb27XMeZubNcBNN+9IgEPIQw= +github.com/aws/smithy-go v1.20.1/go.mod h1:krry+ya/rV9RDcV/Q16kpu6ypI4K2czasz0NC3qS14E= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= @@ -45,6 +60,7 @@ github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7 github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= +github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= @@ -78,9 +94,13 @@ github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.3/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.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-replayers/grpcreplay v1.1.0 h1:S5+I3zYyZ+GQz68OfbURDdt/+cSMqCK1wrvNx7WBzTE= +github.com/google/go-replayers/grpcreplay v1.1.0/go.mod h1:qzAvJ8/wi57zq7gWqaE6AwLM6miiXUQwP1S+I9icmhk= github.com/google/go-replayers/httpreplay v1.2.0 h1:VM1wEyyjaoU53BwrOnaf9VhAyQQEEioJvFYxYcLRKzk= +github.com/google/go-replayers/httpreplay v1.2.0/go.mod h1:WahEFFZZ7a1P4VM1qEeHy+tME4bwyqPcwWbNlUI1Mcg= github.com/google/martian/v3 v3.3.2 h1:IqNFLAmvJOgVlpdEBiQbDc2EwKW77amAycfTuWKdfvw= +github.com/google/martian/v3 v3.3.2/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= github.com/google/s2a-go v0.1.7 h1:60BLSyTrOV4/haCDW4zb1guZItoSq8foHCXrAnjBo/o= github.com/google/s2a-go v0.1.7/go.mod h1:50CgR4k1jNlWBu4UfS4AcfhVe1r6pdZPygJ3R8F0Qdw= github.com/google/subcommands v1.2.0/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk= @@ -116,11 +136,13 @@ github.com/jcmturner/gokrb5/v8 v8.4.4/go.mod h1:1btQEpgT6k+unzCwX1KdWMEwPPkkgBtP github.com/jcmturner/rpc/v2 v2.0.3 h1:7FXXj8Ti1IaVFpSAziCZWNzbNuZmnvw/i6CqLNdWfZY= github.com/jcmturner/rpc/v2 v2.0.3/go.mod h1:VUJYCIDm3PVOEHw8sgt091/20OJjskO/YJki3ELg/Hc= github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= +github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= github.com/klauspost/compress v1.17.7 h1:ehO88t2UGzQK66LMdE8tibEd1ErmzZjNEqWkjLAKQQg= github.com/klauspost/compress v1.17.7/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= github.com/kolo/xmlrpc v0.0.0-20220921171641-a4b6fa1dd06b h1:udzkj9S/zlT5X367kqJis0QP7YMxobob6zhzq6Yre00= github.com/kolo/xmlrpc v0.0.0-20220921171641-a4b6fa1dd06b/go.mod h1:pcaDhQK0/NJZEvtCO0qQPPropqV0sJOJ6YW7X+9kRwM= github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= +github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= @@ -148,6 +170,7 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f h1:J9EGpcZtP0E/raorCMxlFGSTBrsSlaDGf3jU/qvAE2c= github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0= @@ -166,6 +189,7 @@ go.opentelemetry.io/otel v1.24.0/go.mod h1:W7b9Ozg4nkF5tWI5zsXkaKKDjdVjpD4oAt9Qi go.opentelemetry.io/otel/metric v1.24.0 h1:6EhoGWWK28x1fbpA4tYTOWBkPefTDQnb8WSGXlc88kI= go.opentelemetry.io/otel/metric v1.24.0/go.mod h1:VYhLe1rFfxuTXLgj4CBiyz+9WYBA8pNGJgDcSFRKBco= go.opentelemetry.io/otel/sdk v1.22.0 h1:6coWHw9xw7EfClIC/+O31R8IY3/+EiRFHevmHafB2Gw= +go.opentelemetry.io/otel/sdk v1.22.0/go.mod h1:iu7luyVGYovrRpe2fmj3CVKouQNdTOkxtLzPvPz1DOc= go.opentelemetry.io/otel/trace v1.24.0 h1:CsKnnL4dUAr/0llH9FKuc698G04IrpWV0MQA/Y1YELI= go.opentelemetry.io/otel/trace v1.24.0/go.mod h1:HPc3Xr/cOApsBI154IU0OI0HJexz+aw5uPdbs3UCjNU= gocloud.dev v0.37.0 h1:XF1rN6R0qZI/9DYjN16Uy0durAmSlf58DHOcb28GPro= @@ -299,6 +323,7 @@ google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGm google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/pkg/feeds/crates/crates_test.go b/pkg/feeds/crates/crates_test.go index 971cfae7..4dd30714 100644 --- a/pkg/feeds/crates/crates_test.go +++ b/pkg/feeds/crates/crates_test.go @@ -85,7 +85,7 @@ func TestCratesNotFound(t *testing.T) { } } -func cratesSummaryResponse(w http.ResponseWriter, r *http.Request) { +func cratesSummaryResponse(w http.ResponseWriter, _ *http.Request) { _, err := w.Write([]byte(` { "just_updated": [ diff --git a/pkg/feeds/goproxy/goproxy_test.go b/pkg/feeds/goproxy/goproxy_test.go index 0e77a482..5daa8bca 100644 --- a/pkg/feeds/goproxy/goproxy_test.go +++ b/pkg/feeds/goproxy/goproxy_test.go @@ -83,7 +83,7 @@ func TestGoproxyNotFound(t *testing.T) { } } -func goproxyPackageResponse(w http.ResponseWriter, r *http.Request) { +func goproxyPackageResponse(w http.ResponseWriter, _ *http.Request) { _, err := w.Write([]byte(`{"Path": "golang.org/x/foo","Version": "v0.3.0","Timestamp": "2019-04-10T19:08:52.997264Z"} {"Path": "golang.org/x/bar","Version": "v0.4.0","Timestamp": "2019-04-10T20:30:02.04035Z"} `)) diff --git a/pkg/feeds/maven/maven_test.go b/pkg/feeds/maven/maven_test.go index 1b9621b1..3fa0f41a 100644 --- a/pkg/feeds/maven/maven_test.go +++ b/pkg/feeds/maven/maven_test.go @@ -74,7 +74,7 @@ func TestMavenNotFound(t *testing.T) { } } -func mavenPackageResponse(w http.ResponseWriter, r *http.Request) { +func mavenPackageResponse(w http.ResponseWriter, _ *http.Request) { w.Header().Set("Content-Type", "application/json") responseJSON := ` { diff --git a/pkg/feeds/npm/npm_test.go b/pkg/feeds/npm/npm_test.go index 9c41adb5..24db57d6 100644 --- a/pkg/feeds/npm/npm_test.go +++ b/pkg/feeds/npm/npm_test.go @@ -375,7 +375,7 @@ func TestNpmCriticalPartialNotFound(t *testing.T) { } } -func npmLatestPackagesResponse(w http.ResponseWriter, r *http.Request) { +func npmLatestPackagesResponse(w http.ResponseWriter, _ *http.Request) { _, err := w.Write([]byte(` @@ -425,7 +425,7 @@ func npmLatestPackagesResponse(w http.ResponseWriter, r *http.Request) { } } -func fooVersionInfoResponse(w http.ResponseWriter, r *http.Request) { +func fooVersionInfoResponse(w http.ResponseWriter, _ *http.Request) { _, err := w.Write([]byte(` { "name": "FooPackage", @@ -447,7 +447,7 @@ func fooVersionInfoResponse(w http.ResponseWriter, r *http.Request) { } } -func barVersionInfoResponse(w http.ResponseWriter, r *http.Request) { +func barVersionInfoResponse(w http.ResponseWriter, _ *http.Request) { _, err := w.Write([]byte(` { "name": "BarPackage", @@ -470,7 +470,7 @@ func barVersionInfoResponse(w http.ResponseWriter, r *http.Request) { // BazPackage has 2 entries in the registry rss, as such it should result // in both tags being resolved, in date order. -func bazVersionInfoResponse(w http.ResponseWriter, r *http.Request) { +func bazVersionInfoResponse(w http.ResponseWriter, _ *http.Request) { _, err := w.Write([]byte(` { "name": "BazPackage", @@ -494,7 +494,7 @@ func bazVersionInfoResponse(w http.ResponseWriter, r *http.Request) { // the 'firehose' but a *feeds.Package{} should not be generated. Completely // unpublishing a package entails there's a minimum of 24hours before a new version // of it may be published. -func quxVersionInfoResponse(w http.ResponseWriter, r *http.Request) { +func quxVersionInfoResponse(w http.ResponseWriter, _ *http.Request) { _, err := w.Write([]byte(` { "name": "QuxPackage", @@ -524,7 +524,7 @@ func quxVersionInfoResponse(w http.ResponseWriter, r *http.Request) { // were to happen for a single registry entry (count == 1), then the // `cutoff` should handle older than expected versions being mistakenly // processed, assuming it was not completely unpublished. -func quuxVersionInfoResponse(w http.ResponseWriter, r *http.Request) { +func quuxVersionInfoResponse(w http.ResponseWriter, _ *http.Request) { _, err := w.Write([]byte(` { "name": "QuuxPackage", @@ -543,7 +543,7 @@ func quuxVersionInfoResponse(w http.ResponseWriter, r *http.Request) { } } -func nonUtf8Response(w http.ResponseWriter, r *http.Request) { +func nonUtf8Response(w http.ResponseWriter, _ *http.Request) { _, err := w.Write([]byte(` @@ -563,7 +563,7 @@ func nonUtf8Response(w http.ResponseWriter, r *http.Request) { } } -func nonXMLResponse(w http.ResponseWriter, r *http.Request) { +func nonXMLResponse(w http.ResponseWriter, _ *http.Request) { nonXMLChars := "\u0002\u0010\u0014\u0016\u001b\u0000" xml := ` diff --git a/pkg/feeds/nuget/nuget_test.go b/pkg/feeds/nuget/nuget_test.go index 6c729b5f..72f0f4d9 100644 --- a/pkg/feeds/nuget/nuget_test.go +++ b/pkg/feeds/nuget/nuget_test.go @@ -74,7 +74,7 @@ func TestCanParseFeed(t *testing.T) { } } -func indexMock(w http.ResponseWriter, r *http.Request) { +func indexMock(w http.ResponseWriter, _ *http.Request) { var err error catalogEndpoint, err := makeTestURL("v3/catalog0/index.json") if err != nil { @@ -89,7 +89,7 @@ func indexMock(w http.ResponseWriter, r *http.Request) { } } -func catalogMock(w http.ResponseWriter, r *http.Request) { +func catalogMock(w http.ResponseWriter, _ *http.Request) { var err error pageEndpoint, err := makeTestURL("v3/catalog0/page1.json") if err != nil { @@ -104,7 +104,7 @@ func catalogMock(w http.ResponseWriter, r *http.Request) { } } -func catalogPageMock(w http.ResponseWriter, r *http.Request) { +func catalogPageMock(w http.ResponseWriter, _ *http.Request) { var err error pkgAdded := "nuget:PackageDetails" pkgDeleted := "nuget:PackageDelete" @@ -145,7 +145,7 @@ func catalogPageMock(w http.ResponseWriter, r *http.Request) { } } -func packageDetailMock(w http.ResponseWriter, r *http.Request) { +func packageDetailMock(w http.ResponseWriter, _ *http.Request) { response := fmt.Sprintf(`{"id": "new.expected.package", "version": "0.0.1", "published": "%s"}`, time.Now().UTC().Add(-1*time.Minute).Format(time.RFC3339)) diff --git a/pkg/feeds/pypi/pypi_test.go b/pkg/feeds/pypi/pypi_test.go index 024c79d6..3811100e 100644 --- a/pkg/feeds/pypi/pypi_test.go +++ b/pkg/feeds/pypi/pypi_test.go @@ -189,7 +189,7 @@ func TestPypiCriticalPartialNotFound(t *testing.T) { } // Mock data for pypi firehose with all packages. -func updatesXMLHandle(w http.ResponseWriter, r *http.Request) { +func updatesXMLHandle(w http.ResponseWriter, _ *http.Request) { _, err := w.Write([]byte(` @@ -222,7 +222,7 @@ func updatesXMLHandle(w http.ResponseWriter, r *http.Request) { // Mock data response for package specific api when pypi is configured with // a package list in FeedOptions. -func foopyReleasesResponse(w http.ResponseWriter, r *http.Request) { +func foopyReleasesResponse(w http.ResponseWriter, _ *http.Request) { _, err := w.Write([]byte(` @@ -251,7 +251,7 @@ func foopyReleasesResponse(w http.ResponseWriter, r *http.Request) { // Mock data response for package specific api when pypi is configured with // a package list in FeedOptions. -func barpyReleasesResponse(w http.ResponseWriter, r *http.Request) { +func barpyReleasesResponse(w http.ResponseWriter, _ *http.Request) { _, err := w.Write([]byte(` diff --git a/pkg/feeds/rubygems/rubygems_test.go b/pkg/feeds/rubygems/rubygems_test.go index 24adb7a8..cae8b84f 100644 --- a/pkg/feeds/rubygems/rubygems_test.go +++ b/pkg/feeds/rubygems/rubygems_test.go @@ -126,7 +126,7 @@ func TestRubyGemsPartialNotFound(t *testing.T) { } } -func rubyGemsPackagesResponse(w http.ResponseWriter, r *http.Request) { +func rubyGemsPackagesResponse(w http.ResponseWriter, _ *http.Request) { _, err := w.Write([]byte(` [ { diff --git a/pkg/publisher/gcppubsub/gcppubsub.go b/pkg/publisher/gcppubsub/gcppubsub.go index 9db852b0..0bab66bf 100644 --- a/pkg/publisher/gcppubsub/gcppubsub.go +++ b/pkg/publisher/gcppubsub/gcppubsub.go @@ -21,7 +21,7 @@ type Config struct { } func New(ctx context.Context, url string) (*GCPPubSub, error) { - topic, err := pubsub.OpenTopic(context.TODO(), url) + topic, err := pubsub.OpenTopic(ctx, url) if err != nil { return nil, err } diff --git a/pkg/publisher/httpclientpubsub/httpclientpubsub.go b/pkg/publisher/httpclientpubsub/httpclientpubsub.go index 3b00c832..890cdaae 100644 --- a/pkg/publisher/httpclientpubsub/httpclientpubsub.go +++ b/pkg/publisher/httpclientpubsub/httpclientpubsub.go @@ -22,7 +22,7 @@ type HTTPClientPubSub struct { url string } -func New(ctx context.Context, url string) (*HTTPClientPubSub, error) { +func New(_ context.Context, url string) (*HTTPClientPubSub, error) { pub := &HTTPClientPubSub{url: url} return pub, nil } @@ -35,7 +35,7 @@ func FromConfig(ctx context.Context, config Config) (*HTTPClientPubSub, error) { return New(ctx, config.URL) } -func (pub *HTTPClientPubSub) Send(ctx context.Context, body []byte) error { +func (pub *HTTPClientPubSub) Send(_ context.Context, body []byte) error { log.Info("Sending event to HTTP client publisher") // Print the url to the log so that we can see where the event is being sent. req, err := http.NewRequest("POST", pub.url, bytes.NewReader(body)) diff --git a/pkg/publisher/kafkapubsub/kafkapubsub.go b/pkg/publisher/kafkapubsub/kafkapubsub.go index 0c0ebe98..5c88d363 100644 --- a/pkg/publisher/kafkapubsub/kafkapubsub.go +++ b/pkg/publisher/kafkapubsub/kafkapubsub.go @@ -20,7 +20,7 @@ type Config struct { Topic string `mapstructure:"topic"` } -func New(ctx context.Context, brokers []string, topic string) (*KafkaPubSub, error) { +func New(_ context.Context, brokers []string, topic string) (*KafkaPubSub, error) { config := kafkapubsub.MinimalConfig() pubSubTopic, err := kafkapubsub.OpenTopic(brokers, config, topic, nil) diff --git a/pkg/publisher/stdout/stdout.go b/pkg/publisher/stdout/stdout.go index abb44574..4855c7f6 100644 --- a/pkg/publisher/stdout/stdout.go +++ b/pkg/publisher/stdout/stdout.go @@ -19,7 +19,7 @@ func (pub *Stdout) Name() string { return PublisherType } -func (pub *Stdout) Send(ctx context.Context, body []byte) error { +func (pub *Stdout) Send(_ context.Context, body []byte) error { fmt.Printf("%s\n", body) return nil } diff --git a/pkg/scheduler/feed_group_test.go b/pkg/scheduler/feed_group_test.go index cf7aad40..b44b2ff6 100644 --- a/pkg/scheduler/feed_group_test.go +++ b/pkg/scheduler/feed_group_test.go @@ -112,7 +112,7 @@ func TestFeedGroupPublishWithErr(t *testing.T) { } mockFeeds := []feeds.ScheduledFeed{} - mockPub := mockPublisher{sendCallback: func(msg string) error { + mockPub := mockPublisher{sendCallback: func(_ string) error { return errPublishing }} var pub publisher.Publisher = mockPub diff --git a/pkg/scheduler/feed_groups_handler.go b/pkg/scheduler/feed_groups_handler.go index fe9b91b6..15282664 100644 --- a/pkg/scheduler/feed_groups_handler.go +++ b/pkg/scheduler/feed_groups_handler.go @@ -14,7 +14,7 @@ func NewFeedGroupsHandler(feeds []*FeedGroup) *FeedGroupsHandler { return &FeedGroupsHandler{feedGroups: feeds} } -func (srv *FeedGroupsHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { +func (srv *FeedGroupsHandler) ServeHTTP(w http.ResponseWriter, _ *http.Request) { resultChannel := make(chan groupResult, len(srv.feedGroups)) numPublished := 0 var pollErr, pubErr error diff --git a/pkg/scheduler/mocks.go b/pkg/scheduler/mocks.go index 3392e1e7..d9af6a56 100644 --- a/pkg/scheduler/mocks.go +++ b/pkg/scheduler/mocks.go @@ -23,7 +23,7 @@ func (feed mockFeed) GetFeedOptions() feeds.FeedOptions { return feed.options } -func (feed mockFeed) Latest(cutoff time.Time) ([]*feeds.Package, time.Time, []error) { +func (feed mockFeed) Latest(_ time.Time) ([]*feeds.Package, time.Time, []error) { return feed.packages, feed.cutoff, feed.errs } @@ -31,7 +31,7 @@ type mockPublisher struct { sendCallback func(string) error } -func (pub mockPublisher) Send(ctx context.Context, body []byte) error { +func (pub mockPublisher) Send(_ context.Context, body []byte) error { if pub.sendCallback != nil { return pub.sendCallback(string(body)) } diff --git a/pkg/scheduler/scheduler.go b/pkg/scheduler/scheduler.go index 4442d828..20808666 100644 --- a/pkg/scheduler/scheduler.go +++ b/pkg/scheduler/scheduler.go @@ -38,7 +38,7 @@ type pollResult struct { } // healthCheckHandler is a simple health check handler for the HTTP server. -func healthCheckHandler(w http.ResponseWriter, r *http.Request) { +func healthCheckHandler(w http.ResponseWriter, _ *http.Request) { w.Header().Set("Content-Type", "application/json") // Define a simple JSON response structure