diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 5136a54..9e3b048 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,11 +1,16 @@ version: 2 updates: -- package-ecosystem: gomod - directory: "/" - schedule: - interval: daily - labels: - - "area/dependency" - - "release-note-none" - - "ok-to-test" - open-pull-requests-limit: 10 + - package-ecosystem: gomod + directory: "/" + schedule: + interval: daily + labels: + - "area/dependency" + - "release-note-none" + - "ok-to-test" + open-pull-requests-limit: 10 + groups: + all: + update-types: + - "minor" + - "patch" diff --git a/.golangci.yml b/.golangci.yml index bc75751..6125623 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -135,61 +135,38 @@ linters-settings: check-blank: true gocritic: enabled-checks: - - appendAssign - appendCombine - - argOrder - - assignOp - - badCall - - badCond - badLock - badRegexp - badSorting - boolExprSimplify - builtinShadow - builtinShadowDecl - - captLocal - - caseOrder - - codegenComment - - commentFormatting - commentedOutCode - commentedOutImport - - defaultCaseOrder - deferInLoop - deferUnlambda - - deprecatedComment - docStub - - dupArg - - dupBranchBody - - dupCase - dupImport - - dupSubExpr - dynamicFmtString - - elseif - emptyDecl - emptyFallthrough - emptyStringTest - equalFold - evalOrder - - exitAfterDefer - exposedSyncMutex - externalErrorReassign - filepathJoin - - flagDeref - - flagName - hexLiteral - httpNoBody - hugeParam - - ifElseChain - importShadow - indexAlloc - initClause - - mapKey - methodExprCall - nestingReduce - - newDeref - nilValReturn - octalLiteral - - offBy1 - paramTypeCombine - preferDecodeRune - preferFilepathJoin @@ -200,43 +177,31 @@ linters-settings: - rangeExprCopy - rangeValCopy - redundantSprint - - regexpMust - regexpPattern - regexpSimplify - returnAfterHttpError - ruleguard - - singleCaseSwitch - sliceClear - - sloppyLen - sloppyReassign - - sloppyTypeAssert - sortSlice - sprintfQuotedString - sqlQuery - stringConcatSimplify - stringXbytes - stringsCompare - - switchTrue - syncMapLoadAndDelete - - timeCmpSimplify - timeExprSimplify - tooManyResultsChecker - truncateCmp - typeAssertChain - typeDefFirst - - typeSwitchVar - typeUnparen - uncheckedInlineErr - - underef - unlabelStmt - - unlambda - unnamedResult - unnecessaryBlock - unnecessaryDefer - - unslice - - valSwap - weakCond - - wrapperFunc - yodaStyleExpr nolintlint: # Enable to ensure that nolint directives are all used. Default is true. diff --git a/dependencies.yaml b/dependencies.yaml index ebf880f..076174a 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -1,21 +1,21 @@ dependencies: # golangci/golangci-lint - name: "golangci-lint" - version: 1.55.2 + version: 1.57.1 refPaths: - path: mage/golangci-lint.go match: defaultGolangCILintVersion\s+=\s+"v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?" # ko - name: "ko" - version: 0.15.0 + version: 0.15.2 refPaths: - path: mage/ko.go match: defaultKoVersion\s+=\s+"(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?" # cosign - name: "cosign" - version: 2.2.0 + version: 2.2.3 refPaths: - path: mage/cosign.go match: defaultCosignVersion\s+=\s+"v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?" @@ -29,7 +29,7 @@ dependencies: # sigs.k8s.io/zeitgeist - name: "zeitgeist" - version: 0.4.3 + version: 0.4.4 refPaths: - path: mage/dependency.go match: defaultZeitgeistVersion\s+=\s+"v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?" diff --git a/editor/editor.go b/editor/editor.go index 550ce7f..bf93e86 100644 --- a/editor/editor.go +++ b/editor/editor.go @@ -73,10 +73,10 @@ func defaultEnvShell() []string { func defaultEnvEditor(envs []string) ([]string, bool) { var editor string for _, env := range envs { - if len(env) > 0 { + if env != "" { editor = os.Getenv(env) } - if len(editor) > 0 { + if editor != "" { break } } diff --git a/go.mod b/go.mod index 01f991c..ff7d4be 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module sigs.k8s.io/release-utils -go 1.20 +go 1.21 require ( github.com/blang/semver/v4 v4.0.0 diff --git a/go.sum b/go.sum index 63096e5..51c64f1 100644 --- a/go.sum +++ b/go.sum @@ -11,6 +11,7 @@ github.com/common-nighthawk/go-figure v0.0.0-20210622060536-734e95fb86be/go.mod github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/creack/pty v1.1.18 h1:n56/Zwd5o6whRC5PMGretI4IdRLlmBXYNjScPaBgsbY= +github.com/creack/pty v1.1.18/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 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= @@ -22,6 +23,7 @@ github.com/golang/snappy v0.0.2 h1:aeE13tS0IiQgFjYdoL8qN3K1N2bXXtI6Vi51/y7BpMw= github.com/golang/snappy v0.0.2/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/klauspost/compress v1.4.1/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= @@ -49,6 +51,7 @@ github.com/moby/term v0.5.0/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3 github.com/nwaples/rardecode v1.1.0 h1:vSxaY8vQhOcVr4mm5e8XllHWTiM4JF507A0Katqw7MQ= github.com/nwaples/rardecode v1.1.0/go.mod h1:5DzqNKiOdpKKBH87u8VlvAnPZMXcGRhxWkRpHbbfGS0= github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI= +github.com/onsi/gomega v1.27.10/go.mod h1:RsS8tutOdbdgzbPtzzATp12yT7kM5I5aElG3evPbQ0M= github.com/pierrec/lz4/v4 v4.1.2 h1:qvY3YFXRQE/XB8MlLzJH7mSzBs74eA2gg52YTk6jUPM= github.com/pierrec/lz4/v4 v4.1.2/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -59,6 +62,7 @@ github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBO github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/sclevine/spec v1.4.0 h1:z/Q9idDcay5m5irkZ28M7PtQM4aOISzOpj4bUPkDee8= +github.com/sclevine/spec v1.4.0/go.mod h1:LvpgJaFyvQzRvc1kaDs0bulYwzC70PbiYjC4QnFHkOM= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= @@ -87,7 +91,9 @@ golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.14.0 h1:BONx9s002vGdD9umnlX1Po8vOZmrgH34qlHcD1MfK14= +golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI= golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= +golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= 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-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -97,6 +103,7 @@ golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 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.12.0 h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc= +golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.12.0 h1:YW6HUoUmYBpwSgyaGaZq1fHjrBjX1rlpZ54T6mu2kss= golang.org/x/tools v0.12.0/go.mod h1:Sc0INKfu04TlqNoRA1hgpFZbhYXHPr4V5DzpSBTPqQM= @@ -104,6 +111,7 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/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/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= 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= diff --git a/http/agent.go b/http/agent.go index c2dd76f..23f2070 100644 --- a/http/agent.go +++ b/http/agent.go @@ -18,6 +18,7 @@ package http import ( "bytes" + "errors" "fmt" "io" "math" @@ -213,7 +214,7 @@ func (impl *defaultAgentImplementation) SendGetRequest(client *http.Client, url func (a *Agent) readResponseToByteArray(response *http.Response) ([]byte, error) { var b bytes.Buffer if err := a.readResponse(response, &b); err != nil { - return nil, fmt.Errorf("reading") + return nil, errors.New("reading") } return b.Bytes(), nil } diff --git a/http/http_test.go b/http/http_test.go index 778f532..aed7b2b 100644 --- a/http/http_test.go +++ b/http/http_test.go @@ -33,7 +33,7 @@ import ( func TestGetURLResponseSuccess(t *testing.T) { // Given server := httptest.NewServer(http.HandlerFunc( - func(w http.ResponseWriter, r *http.Request) { + func(w http.ResponseWriter, _ *http.Request) { _, err := io.WriteString(w, "") require.Nil(t, err) })) @@ -51,7 +51,7 @@ func TestGetURLResponseSuccessTrimmed(t *testing.T) { // Given const expected = " some test " server := httptest.NewServer(http.HandlerFunc( - func(w http.ResponseWriter, r *http.Request) { + func(w http.ResponseWriter, _ *http.Request) { _, err := io.WriteString(w, expected) require.Nil(t, err) })) @@ -68,7 +68,7 @@ func TestGetURLResponseSuccessTrimmed(t *testing.T) { func TestGetURLResponseFailedStatus(t *testing.T) { // Given server := httptest.NewServer(http.HandlerFunc( - func(w http.ResponseWriter, r *http.Request) { + func(w http.ResponseWriter, _ *http.Request) { w.WriteHeader(http.StatusBadRequest) })) defer server.Close() diff --git a/log/hooks.go b/log/hooks.go index 3e27c50..04b5960 100644 --- a/log/hooks.go +++ b/log/hooks.go @@ -41,7 +41,7 @@ func NewFilenameHook() *FileNameHook { return &FileNameHook{ field: "file", skipPrefix: []string{"log/", "logrus/", "logrus@"}, - Formatter: func(file, function string, line int) string { + Formatter: func(file, _ string, line int) string { return fmt.Sprintf("%s:%d", file, line) }, } diff --git a/mage/cosign.go b/mage/cosign.go index 36675c3..a02c9bb 100644 --- a/mage/cosign.go +++ b/mage/cosign.go @@ -25,7 +25,7 @@ import ( "github.com/uwu-tools/magex/pkg/downloads" ) -const defaultCosignVersion = "v2.2.0" +const defaultCosignVersion = "v2.2.3" // EnsureCosign makes sure that the specified cosign version is available func EnsureCosign(version string) error { diff --git a/mage/dependency.go b/mage/dependency.go index d547ac1..3e1f691 100644 --- a/mage/dependency.go +++ b/mage/dependency.go @@ -27,7 +27,7 @@ import ( const ( // zeitgeist - defaultZeitgeistVersion = "v0.4.3" + defaultZeitgeistVersion = "v0.4.4" zeitgeistCmd = "zeitgeist" zeitgeistModule = "sigs.k8s.io/zeitgeist" ) diff --git a/mage/golangci-lint.go b/mage/golangci-lint.go index 01d7082..4df7aa7 100644 --- a/mage/golangci-lint.go +++ b/mage/golangci-lint.go @@ -37,11 +37,11 @@ import ( const ( // golangci-lint - defaultGolangCILintVersion = "v1.55.2" + defaultGolangCILintVersion = "v1.57.1" golangciCmd = "golangci-lint" golangciConfig = ".golangci.yml" golangciURLBase = "https://raw.githubusercontent.com/golangci/golangci-lint" - defaultMinGoVersion = "1.20" + defaultMinGoVersion = "1.21" ) // Ensure golangci-lint is installed and on the PATH. @@ -191,7 +191,7 @@ func testGo(verbose bool, tags string, pkgs ...string) error { func VerifyGoMod() error { minGoVersion := env.Default("MIN_GO_VERSION", defaultMinGoVersion) if err := shx.RunV( - "go", "mod", "tidy", fmt.Sprintf("-compat=%s", minGoVersion), + "go", "mod", "tidy", "-compat="+minGoVersion, ); err != nil { return fmt.Errorf("running go mod tidy: %w", err) } diff --git a/mage/ko.go b/mage/ko.go index b7e90d2..76dcda1 100644 --- a/mage/ko.go +++ b/mage/ko.go @@ -25,7 +25,7 @@ import ( "github.com/uwu-tools/magex/pkg/downloads" ) -const defaultKoVersion = "0.15.0" +const defaultKoVersion = "0.15.2" // EnsureKO func EnsureKO(version string) error { diff --git a/tar/tar_test.go b/tar/tar_test.go index bc7bf57..51dcddb 100644 --- a/tar/tar_test.go +++ b/tar/tar_test.go @@ -160,7 +160,7 @@ func TestExtract(t *testing.T) { } require.Nil(t, filepath.Walk( baseTmpDir, - func(filePath string, fileInfo os.FileInfo, err error) error { + func(_ string, fileInfo os.FileInfo, _ error) error { require.Equal(t, res[0], fileInfo.Name()) if res[0] == "link" { require.True(t, fileInfo.Mode()&os.ModeSymlink == os.ModeSymlink) diff --git a/util/common_test.go b/util/common_test.go index 90aa25d..29af825 100644 --- a/util/common_test.go +++ b/util/common_test.go @@ -18,7 +18,6 @@ package util import ( "errors" - "fmt" "os" "path/filepath" "testing" @@ -496,7 +495,7 @@ func TestStripSensitiveData(t *testing.T) { for _, tc := range testCases { testBytes := []byte(tc.text) if tc.mustChange { - require.NotEqual(t, StripSensitiveData(testBytes), testBytes, fmt.Sprintf("Failed sanitizing %s", tc.text)) + require.NotEqual(t, StripSensitiveData(testBytes), testBytes, "Failed sanitizing "+tc.text) } else { require.ElementsMatch(t, StripSensitiveData(testBytes), testBytes) } diff --git a/version/command.go b/version/command.go index e8ca11d..d916e93 100644 --- a/version/command.go +++ b/version/command.go @@ -47,7 +47,7 @@ func version(fontName string) *cobra.Command { cmd := &cobra.Command{ Use: "version", Short: "Prints the version", - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *cobra.Command, _ []string) error { v := GetVersionInfo() v.Name = cmd.Root().Name() v.Description = cmd.Root().Short