diff --git a/.golangci.yaml b/.golangci.yaml index 4e3d7f1..025bf8c 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -153,6 +153,9 @@ issues: - text: "G404" linters: - gosec + - text: "SA1019" + linters: + - staticcheck run: skip-dirs: diff --git a/go.mod b/go.mod index ddd9733..12082e3 100644 --- a/go.mod +++ b/go.mod @@ -11,8 +11,8 @@ require ( github.com/Masterminds/semver/v3 v3.2.1 github.com/aserto-dev/aserto-grpc v0.2.3 github.com/aserto-dev/azm v0.1.11 - github.com/aserto-dev/errors v0.0.8 - github.com/aserto-dev/go-directory v0.31.5 + github.com/aserto-dev/errors v0.0.9 + github.com/aserto-dev/go-directory v0.31.6 github.com/bufbuild/protovalidate-go v0.6.3 github.com/go-http-utils/headers v0.0.0-20181008091004-fed159eddc2a github.com/gonvenience/ytbx v1.4.4 @@ -31,7 +31,7 @@ require ( ) require ( - buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.34.2-20240508200655-46a4cf4ba109.2 // indirect + buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.34.2-20240717164558-a6c49f84cc0f.2 // indirect github.com/BurntSushi/toml v1.4.0 // indirect github.com/antlr4-go/antlr/v4 v4.13.1 // indirect github.com/aserto-dev/header v0.0.7 // indirect @@ -62,13 +62,13 @@ require ( github.com/stoewer/go-strcase v1.3.0 // indirect github.com/texttheater/golang-levenshtein v1.0.1 // indirect github.com/virtuald/go-ordered-json v0.0.0-20170621173500-b18e6e673d74 // indirect - golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 // indirect - golang.org/x/net v0.26.0 // indirect - golang.org/x/sys v0.21.0 // indirect - golang.org/x/term v0.21.0 // indirect + golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect + golang.org/x/net v0.27.0 // indirect + golang.org/x/sys v0.22.0 // indirect + golang.org/x/term v0.22.0 // indirect golang.org/x/text v0.16.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20240624140628-dc46fd24d27d // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240624140628-dc46fd24d27d // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240722135656-d784300faade // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240722135656-d784300faade // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index a622321..8bc1fe5 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,5 @@ -buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.34.2-20240508200655-46a4cf4ba109.2 h1:cFrEG/pJch6t62+jqndcPXeTNkYcztS4tBRgNkR+drw= -buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.34.2-20240508200655-46a4cf4ba109.2/go.mod h1:ylS4c28ACSI59oJrOdW4pHS4n0Hw4TgSPHn8rpHl4Yw= +buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.34.2-20240717164558-a6c49f84cc0f.2 h1:SZRVx928rbYZ6hEKUIN+vtGDkl7uotABRWGY4OAg5gM= +buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.34.2-20240717164558-a6c49f84cc0f.2/go.mod h1:ylS4c28ACSI59oJrOdW4pHS4n0Hw4TgSPHn8rpHl4Yw= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v1.4.0 h1:kuoIxZQy2WRRk1pttg9asf+WVv6tWQuBNVmK8+nqPr0= @@ -12,10 +12,10 @@ github.com/aserto-dev/aserto-grpc v0.2.3 h1:pimQD0nq57dSMrv+nT9hUnN9Uricpp+iJypz github.com/aserto-dev/aserto-grpc v0.2.3/go.mod h1:51Zoq1izr+qv8IXDw7a0J0lWC3gTPupWnDSGvqkd9sI= github.com/aserto-dev/azm v0.1.11 h1:cYpIsmeI7DpwnjqKTKUlz4CqhODpx+zncM97G0kSYu8= github.com/aserto-dev/azm v0.1.11/go.mod h1:p0O2nWcmIsGphsST7QrGzOIalafw6SOtNQeyhN2TnUo= -github.com/aserto-dev/errors v0.0.8 h1:lqfCc3n8f2VIrsj0hOEmktnqYUS6tffl+w1yJftBhp8= -github.com/aserto-dev/errors v0.0.8/go.mod h1:wiQ68oKTyAQVAv+SvB5GyuAD6PewalA/D6Fq30gNUbQ= -github.com/aserto-dev/go-directory v0.31.5 h1:DPGE8SGW2Z3EFS7VB6v0ds81meKXtHGpI0YYrZ7Ea80= -github.com/aserto-dev/go-directory v0.31.5/go.mod h1:fgIT515NcK+4m1UyriBCPMwFHl3DHPaa8yBLbEb9r/I= +github.com/aserto-dev/errors v0.0.9 h1:Pi6UT/v+0DYc25AKVFgazkz7Sua3zyU3KWl5VsoRPKk= +github.com/aserto-dev/errors v0.0.9/go.mod h1:mk3xXE6e9cA5NFk2B3KdNuUcSR+dVGbIlvbaT5ZTOtQ= +github.com/aserto-dev/go-directory v0.31.6 h1:gHL/z2Gegc+CmaarUnNGk+Zya/eJ4eS1vGfEiRYQeX0= +github.com/aserto-dev/go-directory v0.31.6/go.mod h1:T125gQBcPXrLUh7bMPFHzsXRHUnZb++DzhPk8o8tc4k= github.com/aserto-dev/header v0.0.7 h1:hlo5/zYsBOsxzPxtve7LRbXyBbQmKSPAyOfmPhGgirM= github.com/aserto-dev/header v0.0.7/go.mod h1:wDF2S9k2q3lbilNb9q20vPpX8uvlSLYGa4F7p9GtGy4= github.com/aserto-dev/logger v0.0.3 h1:lBB5LMdOsHCJKfEej2xY7s4OzCWUWCBhkhUU6RJ4LbM= @@ -185,8 +185,8 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk 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/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 h1:yixxcjnhBmY0nkL253HFVIm0JsFHwrHdT3Yh6szTnfY= -golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8/go.mod h1:jj3sYF3dwk5D+ghuXyeI3r5MFf+NT2An6/9dOA95KSI= +golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 h1:2dVuKD2vS7b0QIHQbpyTISPd0LeHDbnYEryqj5Q1ug8= +golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56/go.mod h1:M4RDyNAINzryxdtnbRXRL/OHtkFuWGRjvuhBJpk2IlY= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= @@ -201,8 +201,8 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ= -golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= +golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= +golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -220,10 +220,10 @@ golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= -golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/term v0.21.0 h1:WVXCp+/EBEHOj53Rvu+7KiT/iElMrO8ACK16SMZ3jaA= -golang.org/x/term v0.21.0/go.mod h1:ooXLefLobQVslOqselCNF4SxFAaoS6KujMbsGzSDmX0= +golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= +golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/term v0.22.0 h1:BbsgPEJULsl2fV/AT3v15Mjva5yXKQDyKf+TbDz7QJk= +golang.org/x/term v0.22.0/go.mod h1:F3qCibpT5AMpCRfhfT53vVJwhLtIVHhB9XDjfFvnMI4= 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.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= @@ -237,8 +237,8 @@ golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.22.0 h1:gqSGLZqv+AI9lIQzniJ0nZDRG5GBPsSi+DRNHWNz6yA= -golang.org/x/tools v0.22.0/go.mod h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c= +golang.org/x/tools v0.23.0 h1:SGsXPZ+2l4JsgaCKkx+FQ9YZ5XEtA1GZYuoDjenLjvg= +golang.org/x/tools v0.23.0/go.mod h1:pnu6ufv6vQkll6szChhK3C3L/ruaIv5eBeztNG8wtsI= 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= @@ -248,10 +248,10 @@ google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7 google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto/googleapis/api v0.0.0-20240624140628-dc46fd24d27d h1:Aqf0fiIdUQEj0Gn9mKFFXoQfTTEaNopWpfVyYADxiSg= -google.golang.org/genproto/googleapis/api v0.0.0-20240624140628-dc46fd24d27d/go.mod h1:Od4k8V1LQSizPRUK4OzZ7TBE/20k+jPczUDAEyvn69Y= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240624140628-dc46fd24d27d h1:k3zyW3BYYR30e8v3x0bTDdE9vpYFjZHK+HcyqkrppWk= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240624140628-dc46fd24d27d/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= +google.golang.org/genproto/googleapis/api v0.0.0-20240722135656-d784300faade h1:WxZOF2yayUHpHSbUE6NMzumUzBxYc3YGwo0YHnbzsJY= +google.golang.org/genproto/googleapis/api v0.0.0-20240722135656-d784300faade/go.mod h1:mw8MG/Qz5wfgYr6VqVCiZcHe/GJEfI+oGGDCohaVgB0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240722135656-d784300faade h1:oCRSWfwGXQsqlVdErcyTt4A93Y8fo0/9D4b1gnI++qo= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240722135656-d784300faade/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= diff --git a/makefile b/makefile index af805d6..f8b31dc 100644 --- a/makefile +++ b/makefile @@ -1,30 +1,31 @@ -SHELL := $(shell which bash) +SHELL := $(shell which bash) -NO_COLOR := \033[0m -OK_COLOR := \033[32;01m -ERR_COLOR := \033[31;01m -WARN_COLOR := \033[36;01m -ATTN_COLOR := \033[33;01m +NO_COLOR := \033[0m +OK_COLOR := \033[32;01m +ERR_COLOR := \033[31;01m +WARN_COLOR := \033[36;01m +ATTN_COLOR := \033[33;01m -GOOS := $(shell go env GOOS) -GOARCH := $(shell go env GOARCH) -GOPRIVATE := "github.com/aserto-dev" -DOCKER_BUILDKIT := 1 +GOOS := $(shell go env GOOS) +GOARCH := $(shell go env GOARCH) +GOPRIVATE := "github.com/aserto-dev" +DOCKER_BUILDKIT := 1 -EXT_DIR := ./.ext -EXT_BIN_DIR := ${EXT_DIR}/bin -EXT_TMP_DIR := ${EXT_DIR}/tmp +EXT_DIR := ./.ext +EXT_BIN_DIR := ${EXT_DIR}/bin +EXT_TMP_DIR := ${EXT_DIR}/tmp -VAULT_VERSION := 1.8.12 -SVU_VERSION := 1.12.0 -GOTESTSUM_VERSION := 1.11.0 -GOLANGCI-LINT_VERSION := 1.56.2 -GORELEASER_VERSION := 1.24.0 -WIRE_VERSION := 0.6.0 +VAULT_VER := 1.8.12 +SVU_VER := 1.12.0 +GOTESTSUM_VER := 1.11.0 +GOLANGCI-LINT_VER := 1.56.2 +GORELEASER_VER := 1.24.0 +WIRE_VER := 0.6.0 +BUF_VER := 1.34.0 -RELEASE_TAG := $$(svu) +RELEASE_TAG := $$(svu) -.DEFAULT_GOAL := build +.DEFAULT_GOAL := build .PHONY: deps deps: info install-vault install-svu install-goreleaser install-golangci-lint install-gotestsum @@ -88,7 +89,7 @@ info: .PHONY: install-vault install-vault: ${EXT_BIN_DIR} ${EXT_TMP_DIR} @echo -e "$(ATTN_COLOR)==> $@ $(NO_COLOR)" - @curl -s -o ${EXT_TMP_DIR}/vault.zip https://releases.hashicorp.com/vault/${VAULT_VERSION}/vault_${VAULT_VERSION}_${GOOS}_${GOARCH}.zip + @curl -s -o ${EXT_TMP_DIR}/vault.zip https://releases.hashicorp.com/vault/${VAULT_VER}/vault_${VAULT_VER}_${GOOS}_${GOARCH}.zip @unzip -o ${EXT_TMP_DIR}/vault.zip vault -d ${EXT_BIN_DIR}/ &> /dev/null @chmod +x ${EXT_BIN_DIR}/vault @${EXT_BIN_DIR}/vault --version @@ -96,7 +97,7 @@ install-vault: ${EXT_BIN_DIR} ${EXT_TMP_DIR} .PHONY: install-buf install-buf: ${EXT_BIN_DIR} @echo -e "$(ATTN_COLOR)==> $@ $(NO_COLOR)" - @gh release download --repo https://github.com/bufbuild/buf --pattern "buf-$$(uname -s)-$$(uname -m)" --output "${EXT_BIN_DIR}/buf" --clobber + @gh release download v${BUF_VER} --repo https://github.com/bufbuild/buf --pattern "buf-$$(uname -s)-$$(uname -m)" --output "${EXT_BIN_DIR}/buf" --clobber @chmod +x ${EXT_BIN_DIR}/buf @${EXT_BIN_DIR}/buf --version @@ -121,7 +122,7 @@ install-svu-linux: ${EXT_TMP_DIR} ${EXT_BIN_DIR} .PHONY: install-gotestsum install-gotestsum: ${EXT_TMP_DIR} ${EXT_BIN_DIR} @echo -e "$(ATTN_COLOR)==> $@ $(NO_COLOR)" - @gh release download v${GOTESTSUM_VERSION} --repo https://github.com/gotestyourself/gotestsum --pattern "gotestsum_${GOTESTSUM_VERSION}_${GOOS}_${GOARCH}.tar.gz" --output "${EXT_TMP_DIR}/gotestsum.tar.gz" --clobber + @gh release download v${GOTESTSUM_VER} --repo https://github.com/gotestyourself/gotestsum --pattern "gotestsum_${GOTESTSUM_VER}_${GOOS}_${GOARCH}.tar.gz" --output "${EXT_TMP_DIR}/gotestsum.tar.gz" --clobber @tar -xvf ${EXT_TMP_DIR}/gotestsum.tar.gz --directory ${EXT_BIN_DIR} gotestsum &> /dev/null @chmod +x ${EXT_BIN_DIR}/gotestsum @${EXT_BIN_DIR}/gotestsum --version @@ -129,7 +130,7 @@ install-gotestsum: ${EXT_TMP_DIR} ${EXT_BIN_DIR} .PHONY: install-golangci-lint install-golangci-lint: ${EXT_TMP_DIR} ${EXT_BIN_DIR} @echo -e "$(ATTN_COLOR)==> $@ $(NO_COLOR)" - @gh release download v${GOLANGCI-LINT_VERSION} --repo https://github.com/golangci/golangci-lint --pattern "golangci-lint-${GOLANGCI-LINT_VERSION}-${GOOS}-${GOARCH}.tar.gz" --output "${EXT_TMP_DIR}/golangci-lint.tar.gz" --clobber + @gh release download v${GOLANGCI-LINT_VER} --repo https://github.com/golangci/golangci-lint --pattern "golangci-lint-${GOLANGCI-LINT_VER}-${GOOS}-${GOARCH}.tar.gz" --output "${EXT_TMP_DIR}/golangci-lint.tar.gz" --clobber @tar --strip=1 -xvf ${EXT_TMP_DIR}/golangci-lint.tar.gz --strip-components=1 --directory ${EXT_TMP_DIR} &> /dev/null @mv ${EXT_TMP_DIR}/golangci-lint ${EXT_BIN_DIR}/golangci-lint @chmod +x ${EXT_BIN_DIR}/golangci-lint @@ -138,7 +139,7 @@ install-golangci-lint: ${EXT_TMP_DIR} ${EXT_BIN_DIR} .PHONY: install-goreleaser install-goreleaser: ${EXT_TMP_DIR} ${EXT_BIN_DIR} @echo -e "$(ATTN_COLOR)==> $@ $(NO_COLOR)" - @gh release download v${GORELEASER_VERSION} --repo https://github.com/goreleaser/goreleaser --pattern "goreleaser_$$(uname -s)_$$(uname -m).tar.gz" --output "${EXT_TMP_DIR}/goreleaser.tar.gz" --clobber + @gh release download v${GORELEASER_VER} --repo https://github.com/goreleaser/goreleaser --pattern "goreleaser_$$(uname -s)_$$(uname -m).tar.gz" --output "${EXT_TMP_DIR}/goreleaser.tar.gz" --clobber @tar -xvf ${EXT_TMP_DIR}/goreleaser.tar.gz --directory ${EXT_BIN_DIR} goreleaser &> /dev/null @chmod +x ${EXT_BIN_DIR}/goreleaser @${EXT_BIN_DIR}/goreleaser --version @@ -146,13 +147,14 @@ install-goreleaser: ${EXT_TMP_DIR} ${EXT_BIN_DIR} .PHONY: install-wire install-wire: ${EXT_TMP_DIR} ${EXT_BIN_DIR} @echo -e "$(ATTN_COLOR)==> $@ $(NO_COLOR)" - @GOBIN=${PWD}/${EXT_BIN_DIR} go install github.com/google/wire/cmd/wire@v${WIRE_VERSION} + @GOBIN=${PWD}/${EXT_BIN_DIR} go install github.com/google/wire/cmd/wire@v${WIRE_VER} .PHONY: clean clean: @echo -e "$(ATTN_COLOR)==> $@ $(NO_COLOR)" @rm -rf ${EXT_DIR} @rm -rf ${BIN_DIR} + @rm -rf ./dist ${BIN_DIR}: @echo -e "$(ATTN_COLOR)==> $@ $(NO_COLOR)" diff --git a/pkg/bdb/boltdb.go b/pkg/bdb/boltdb.go index 62332eb..4c38b96 100644 --- a/pkg/bdb/boltdb.go +++ b/pkg/bdb/boltdb.go @@ -66,7 +66,7 @@ func (s *BoltDB) Open() error { } } - db, err := bolt.Open(s.config.DBPath, 0644, &bolt.Options{ + db, err := bolt.Open(s.config.DBPath, 0o644, &bolt.Options{ Timeout: s.config.RequestTimeout, FreelistType: bolt.FreelistArrayType, // WARNING: using bolt.FreelistMapType resulted store corruptions in the migration path }) diff --git a/pkg/bdb/migrate/mig/mig.go b/pkg/bdb/migrate/mig/mig.go index ec8a294..94506ef 100644 --- a/pkg/bdb/migrate/mig/mig.go +++ b/pkg/bdb/migrate/mig/mig.go @@ -79,7 +79,6 @@ func CreateBucket(path bdb.Path) func(*zerolog.Logger, *bolt.DB, *bolt.DB) error } return nil - }); err != nil { return err } @@ -119,7 +118,6 @@ func DeleteBucket(path bdb.Path) func(*zerolog.Logger, *bolt.DB, *bolt.DB) error default: return nil } - }); err != nil { return err } @@ -210,7 +208,7 @@ func OpenDB(cfg *bdb.Config) (*bolt.DB, error) { } } - db, err := bolt.Open(cfg.DBPath, 0644, &bolt.Options{ + db, err := bolt.Open(cfg.DBPath, 0o644, &bolt.Options{ Timeout: cfg.RequestTimeout, }) if err != nil { @@ -224,7 +222,7 @@ func OpenDB(cfg *bdb.Config) (*bolt.DB, error) { } func OpenReadOnlyDB(cfg *bdb.Config, version *semver.Version) (*bolt.DB, error) { - db, err := bolt.Open(BackupFilename(cfg.DBPath, version), 0644, &bolt.Options{ + db, err := bolt.Open(BackupFilename(cfg.DBPath, version), 0o644, &bolt.Options{ ReadOnly: true, Timeout: cfg.RequestTimeout, }) diff --git a/pkg/directory/directory.go b/pkg/directory/directory.go index e627dc2..8cb4124 100644 --- a/pkg/directory/directory.go +++ b/pkg/directory/directory.go @@ -103,7 +103,8 @@ func newDirectory(_ context.Context, config *Config, logger *zerolog.Logger) (*D DBPath: config.DBPath, RequestTimeout: config.RequestTimeout, MaxBatchSize: bolt.DefaultMaxBatchSize, - MaxBatchDelay: bolt.DefaultMaxBatchDelay}, + MaxBatchDelay: bolt.DefaultMaxBatchDelay, + }, &newLogger, ) if err != nil { diff --git a/pkg/directory/v3/exporter.go b/pkg/directory/v3/exporter.go index a45339b..a01ddd6 100644 --- a/pkg/directory/v3/exporter.go +++ b/pkg/directory/v3/exporter.go @@ -37,7 +37,6 @@ func (s *Exporter) Export(req *dse3.ExportRequest, stream dse3.Exporter_ExportSe logger := s.logger.With().Str("method", "Export").Interface("req", req).Logger() err := s.store.DB().View(func(tx *bolt.Tx) error { - // stats mode, short circuits when enabled if req.Options&uint32(dse3.Option_OPTION_STATS) != 0 { if err := exportStats(tx, stream, req.Options); err != nil { diff --git a/pkg/directory/v3/importer.go b/pkg/directory/v3/importer.go index 32f6848..072442c 100644 --- a/pkg/directory/v3/importer.go +++ b/pkg/directory/v3/importer.go @@ -76,7 +76,6 @@ func (s *Importer) Import(stream dsi3.Importer_ImportServer) error { } func (s *Importer) handleImportRequest(ctx context.Context, tx *bolt.Tx, req *dsi3.ImportRequest, res *dsi3.ImportResponse) (err error) { - switch m := req.Msg.(type) { case *dsi3.ImportRequest_Object: if req.OpCode == dsi3.Opcode_OPCODE_SET { diff --git a/pkg/fs/fs.go b/pkg/fs/fs.go index a33eb23..9cb6dd5 100644 --- a/pkg/fs/fs.go +++ b/pkg/fs/fs.go @@ -22,7 +22,7 @@ func DirExists(path string) bool { func EnsureDirPath(path string) error { if !DirExists(path) { - return os.MkdirAll(path, 0700) + return os.MkdirAll(path, 0o700) } return nil } diff --git a/pkg/session/id.go b/pkg/session/id.go index a2d93c4..0a3dac8 100644 --- a/pkg/session/id.go +++ b/pkg/session/id.go @@ -12,9 +12,7 @@ import ( "google.golang.org/grpc" ) -var ( - ErrMissingHeader = errors.New("missing required header") -) +var ErrMissingHeader = errors.New("missing required header") type HeaderMiddleware struct { DisableValidation bool diff --git a/tests/manifest_test.go b/tests/manifest_test.go index bd7718e..7155cf1 100644 --- a/tests/manifest_test.go +++ b/tests/manifest_test.go @@ -153,7 +153,7 @@ func testGetManifest(client *server.TestEdgeClient, manifest string) func(*testi } tempManifest := path.Join(os.TempDir(), "manifest.yaml") - if err := os.WriteFile(tempManifest, data.Bytes(), 0600); err != nil { + if err := os.WriteFile(tempManifest, data.Bytes(), 0o600); err != nil { require.NoError(t, err) } @@ -210,7 +210,7 @@ func testGetModel(client *server.TestEdgeClient) func(*testing.T) { } tempModel := path.Join(os.TempDir(), "model.json") - if err := os.WriteFile(tempModel, buf.Bytes(), 0600); err != nil { + if err := os.WriteFile(tempModel, buf.Bytes(), 0o600); err != nil { require.NoError(t, err) } diff --git a/tests/relation_test.go b/tests/relation_test.go index b7c34bf..2fd8d6b 100644 --- a/tests/relation_test.go +++ b/tests/relation_test.go @@ -328,7 +328,6 @@ var relationTestCasesV2 = []*TestCase{ assert.NotNil(t, resp) } return func(proto.Message) {} - }, }, } diff --git a/tests/runner_test.go b/tests/runner_test.go index 840ba8a..f50cf68 100644 --- a/tests/runner_test.go +++ b/tests/runner_test.go @@ -36,7 +36,7 @@ func TestMain(m *testing.M) { logger := zerolog.New(io.Discard) dirPath := os.TempDir() - if err := os.MkdirAll(dirPath, 0700); err != nil { + if err := os.MkdirAll(dirPath, 0o700); err != nil { panic(err) } @@ -84,7 +84,6 @@ func testRunner(t *testing.T, tcs []*TestCase) { } runTestCase(ctx, t, tc) }) - } }