From 4e318e62851df27a9a8bc204d886e8c0a29c7bd8 Mon Sep 17 00:00:00 2001 From: Stephanie Hingtgen Date: Thu, 7 Nov 2024 16:05:14 -0700 Subject: [PATCH] Revert "Chore: Enable cache on golangci linter" (#96069) Revert "Chore: Enable cache on golangci linter (#95471)" This reverts commit d5cde0b60a7f9fab62c0976bc92a7c954ce9ffec. --- .bingo/Variables.mk | 6 +- .bingo/golangci-lint.mod | 6 +- .bingo/golangci-lint.sum | 42 --- .bingo/variables.env | 2 +- .github/CODEOWNERS | 2 +- .github/workflows/go_lint.yml | 8 +- .golangci.toml | 315 ++++++++++++++++++ .golangci.yml | 301 ----------------- .../webhook-listener.go | 6 - pkg/build/wire/.nolint | 0 pkg/util/xorm/.nolint | 0 11 files changed, 328 insertions(+), 360 deletions(-) create mode 100644 .golangci.toml delete mode 100644 .golangci.yml delete mode 100644 pkg/build/wire/.nolint delete mode 100644 pkg/util/xorm/.nolint diff --git a/.bingo/Variables.mk b/.bingo/Variables.mk index b86bc5c20a6..21d5bcb5c62 100644 --- a/.bingo/Variables.mk +++ b/.bingo/Variables.mk @@ -35,11 +35,11 @@ $(DRONE): $(BINGO_DIR)/drone.mod @echo "(re)installing $(GOBIN)/drone-v1.5.0" @cd $(BINGO_DIR) && GOWORK=off CGO_ENABLED=0 $(GO) build -mod=mod -modfile=drone.mod -o=$(GOBIN)/drone-v1.5.0 "github.com/drone/drone-cli/drone" -GOLANGCI_LINT := $(GOBIN)/golangci-lint-v1.61.0 +GOLANGCI_LINT := $(GOBIN)/golangci-lint-v1.60.1 $(GOLANGCI_LINT): $(BINGO_DIR)/golangci-lint.mod @# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies. - @echo "(re)installing $(GOBIN)/golangci-lint-v1.61.0" - @cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=golangci-lint.mod -o=$(GOBIN)/golangci-lint-v1.61.0 "github.com/golangci/golangci-lint/cmd/golangci-lint" + @echo "(re)installing $(GOBIN)/golangci-lint-v1.60.1" + @cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=golangci-lint.mod -o=$(GOBIN)/golangci-lint-v1.60.1 "github.com/golangci/golangci-lint/cmd/golangci-lint" JB := $(GOBIN)/jb-v0.5.1 $(JB): $(BINGO_DIR)/jb.mod diff --git a/.bingo/golangci-lint.mod b/.bingo/golangci-lint.mod index d9523ff2b73..6f043fadfa9 100644 --- a/.bingo/golangci-lint.mod +++ b/.bingo/golangci-lint.mod @@ -1,5 +1,7 @@ module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT -go 1.23 +go 1.22.1 -require github.com/golangci/golangci-lint v1.61.0 // cmd/golangci-lint +toolchain go1.23.0 + +require github.com/golangci/golangci-lint v1.60.1 // cmd/golangci-lint diff --git a/.bingo/golangci-lint.sum b/.bingo/golangci-lint.sum index 9612386a454..60995023a48 100644 --- a/.bingo/golangci-lint.sum +++ b/.bingo/golangci-lint.sum @@ -41,8 +41,6 @@ github.com/4meepo/tagalign v1.3.4 h1:P51VcvBnf04YkHzjfclN6BbsopfJR5rxs1n+5zHt+w8 github.com/4meepo/tagalign v1.3.4/go.mod h1:M+pnkHH2vG8+qhE5bVc/zeP7HS/j910Fwa9TUSyZVI0= github.com/Abirdcfly/dupword v0.0.14 h1:3U4ulkc8EUo+CaT105/GJ1BQwtgyj6+VaBVbAX11Ba8= github.com/Abirdcfly/dupword v0.0.14/go.mod h1:VKDAbxdY8YbKUByLGg8EETzYSuC4crm9WwI6Y3S0cLI= -github.com/Abirdcfly/dupword v0.1.1 h1:Bsxe0fIw6OwBtXMIncaTxCLHYO5BB+3mcsR5E8VXloY= -github.com/Abirdcfly/dupword v0.1.1/go.mod h1:B49AcJdTYYkpd4HjgAcutNGG9HZ2JWwKunH9Y2BA6sM= github.com/Antonboom/errname v0.1.12 h1:oh9ak2zUtsLp5oaEd/erjB4GPu9w19NyoIskZClDcQY= github.com/Antonboom/errname v0.1.12/go.mod h1:bK7todrzvlaZoQagP1orKzWXv59X/x0W0Io2XT1Ssro= github.com/Antonboom/errname v0.1.13 h1:JHICqsewj/fNckzrfVSe+T33svwQxmjC+1ntDsHOVvM= @@ -71,8 +69,6 @@ github.com/Crocmagnon/fatcontext v0.2.2 h1:OrFlsDdOj9hW/oBEJBNSuH7QWf+E9WPVHw+x5 github.com/Crocmagnon/fatcontext v0.2.2/go.mod h1:WSn/c/+MMNiD8Pri0ahRj0o9jVpeowzavOQplBJw6u0= github.com/Crocmagnon/fatcontext v0.4.0 h1:4ykozu23YHA0JB6+thiuEv7iT6xq995qS1vcuWZq0tg= github.com/Crocmagnon/fatcontext v0.4.0/go.mod h1:ZtWrXkgyfsYPzS6K3O88va6t2GEglG93vnII/F94WC0= -github.com/Crocmagnon/fatcontext v0.5.2 h1:vhSEg8Gqng8awhPju2w7MKHqMlg4/NI+gSDHtR3xgwA= -github.com/Crocmagnon/fatcontext v0.5.2/go.mod h1:87XhRMaInHP44Q7Tlc7jkgKKB7kZAOPiDkFMdKCC+74= github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 h1:sHglBQTwgx+rWPdisA5ynNEsoARbiCBOyGcJM4/OzsM= github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24/go.mod h1:4UJr5HIiMZrwgkSPdsjy2uOQExX/WEILpIrO9UPGuXs= github.com/GaijinEntertainment/go-exhaustruct/v3 v3.2.0 h1:sATXp1x6/axKxz2Gjxv8MALP0bXaNRfQinEwyfMcx8c= @@ -83,8 +79,6 @@ github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3Q github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= github.com/Masterminds/semver/v3 v3.2.1 h1:RN9w6+7QoMeJVGyfmbcgs28Br8cvmnucEXnY0rYXWg0= github.com/Masterminds/semver/v3 v3.2.1/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ= -github.com/Masterminds/semver/v3 v3.3.0 h1:B8LGeaivUe71a5qox1ICM/JLl0NqZSW5CHyL+hmvYS0= -github.com/Masterminds/semver/v3 v3.3.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM= github.com/OpenPeeDeeP/depguard/v2 v2.2.0 h1:vDfG60vDtIuf0MEOhmLlLLSzqaRM8EMcgJPdp74zmpA= github.com/OpenPeeDeeP/depguard/v2 v2.2.0/go.mod h1:CIzddKRvLBC4Au5aYP/i3nyaWQ+ClszLIuVocRiCYFQ= github.com/alecthomas/go-check-sumtype v0.1.4 h1:WCvlB3l5Vq5dZQTFmodqL2g68uHiSwwlWcT5a2FGK0c= @@ -145,8 +139,6 @@ github.com/ckaznocha/intrange v0.1.0 h1:ZiGBhvrdsKpoEfzh9CjBfDSZof6QB0ORY5tXasUt github.com/ckaznocha/intrange v0.1.0/go.mod h1:Vwa9Ekex2BrEQMg6zlrWwbs/FtYw7eS5838Q7UjK7TQ= github.com/ckaznocha/intrange v0.1.2 h1:3Y4JAxcMntgb/wABQ6e8Q8leMd26JbX2790lIss9MTI= github.com/ckaznocha/intrange v0.1.2/go.mod h1:RWffCw/vKBwHeOEwWdCikAtY0q4gGt8VhJZEEA5n+RE= -github.com/ckaznocha/intrange v0.2.0 h1:FykcZuJ8BD7oX93YbO1UY9oZtkRbp+1/kJcDjkefYLs= -github.com/ckaznocha/intrange v0.2.0/go.mod h1:r5I7nUlAAG56xmkOpw4XVr16BXhwYTUdcuRFeevn1oE= 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= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= @@ -157,8 +149,6 @@ github.com/daixiang0/gci v0.12.3 h1:yOZI7VAxAGPQmkb1eqt5g/11SUlwoat1fSblGLmdiQc= github.com/daixiang0/gci v0.12.3/go.mod h1:xtHP9N7AHdNvtRNfcx9gwTDfw7FRJx4bZUsiEfiNNAI= github.com/daixiang0/gci v0.13.4 h1:61UGkmpoAcxHM2hhNkZEf5SzwQtWJXTSws7jaPyqwlw= github.com/daixiang0/gci v0.13.4/go.mod h1:12etP2OniiIdP4q+kjUGrC/rUagga7ODbqsom5Eo5Yk= -github.com/daixiang0/gci v0.13.5 h1:kThgmH1yBmZSBCh1EJVxQ7JsHpm5Oms0AMed/0LaH4c= -github.com/daixiang0/gci v0.13.5/go.mod h1:12etP2OniiIdP4q+kjUGrC/rUagga7ODbqsom5Eo5Yk= 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= @@ -223,8 +213,6 @@ github.com/go-viper/mapstructure/v2 v2.0.0-alpha.1 h1:TQcrn6Wq+sKGkpyPvppOz99zsM github.com/go-viper/mapstructure/v2 v2.0.0-alpha.1/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= github.com/go-viper/mapstructure/v2 v2.0.0 h1:dhn8MZ1gZ0mzeodTG3jt5Vj/o87xZKuNAprG2mQfMfc= github.com/go-viper/mapstructure/v2 v2.0.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= -github.com/go-viper/mapstructure/v2 v2.1.0 h1:gHnMa2Y/pIxElCH2GlZZ1lZSsn6XMtufpGyP1XxdC/w= -github.com/go-viper/mapstructure/v2 v2.1.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= github.com/go-xmlfmt/xmlfmt v1.1.2 h1:Nea7b4icn8s57fTx1M5AI4qQT5HEM3rVUO8MuE6g80U= github.com/go-xmlfmt/xmlfmt v1.1.2/go.mod h1:aUCEOzzezBEjDBbFBoSiya/gduyIiWYRP6CnSFIV8AM= github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y= @@ -267,8 +255,6 @@ github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a h1:w8hkcTqaFpzKqonE9 github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a/go.mod h1:ryS0uhF+x9jgbj/N71xsEqODy9BN81/GonCZiOzirOk= github.com/golangci/gofmt v0.0.0-20231018234816-f50ced29576e h1:ULcKCDV1LOZPFxGZaA6TlQbiM3J2GCPnkx/bGF6sX/g= github.com/golangci/gofmt v0.0.0-20231018234816-f50ced29576e/go.mod h1:Pm5KhLPA8gSnQwrQ6ukebRcapGb/BG9iUkdaiCcGHJM= -github.com/golangci/gofmt v0.0.0-20240816233607-d8596aa466a9 h1:/1322Qns6BtQxUZDTAT4SdcoxknUki7IAoK4SAXr8ME= -github.com/golangci/gofmt v0.0.0-20240816233607-d8596aa466a9/go.mod h1:Oesb/0uFAyWoaw1U1qS5zyjCg5NP9C9iwjnI4tIsXEE= github.com/golangci/golangci-lint v1.57.1 h1:cqhpzkzjDwdN12rfMf1SUyyKyp88a1SltNqEYGS0nJw= github.com/golangci/golangci-lint v1.57.1/go.mod h1:zLcHhz3NHc88T5zV2j75lyc0zH3LdOPOybblYa4p0oI= github.com/golangci/golangci-lint v1.59.0 h1:st69YDnAH/v2QXDcgUaZ0seQajHScPALBVkyitYLXEk= @@ -277,8 +263,6 @@ github.com/golangci/golangci-lint v1.59.1 h1:CRRLu1JbhK5avLABFJ/OHVSQ0Ie5c4ulsOI github.com/golangci/golangci-lint v1.59.1/go.mod h1:jX5Oif4C7P0j9++YB2MMJmoNrb01NJ8ITqKWNLewThg= github.com/golangci/golangci-lint v1.60.1 h1:DRKNqNTQRLBJZ1il5u4fvgLQCjQc7QFs0DbhksJtVJE= github.com/golangci/golangci-lint v1.60.1/go.mod h1:jDIPN1rYaIA+ijp9OZcUmUCoQOtZ76pOlFbi15FlLJY= -github.com/golangci/golangci-lint v1.61.0 h1:VvbOLaRVWmyxCnUIMTbf1kDsaJbTzH20FAMXTAlQGu8= -github.com/golangci/golangci-lint v1.61.0/go.mod h1:e4lztIrJJgLPhWvFPDkhiMwEFRrWlmFbrZea3FsJyN8= github.com/golangci/misspell v0.4.1 h1:+y73iSicVy2PqyX7kmUefHusENlrP9YwuHZHPLGQj/g= github.com/golangci/misspell v0.4.1/go.mod h1:9mAN1quEo3DlpbaIKKyEvRxK1pwqR9s/Sea1bJCtlNI= github.com/golangci/misspell v0.5.1 h1:/SjR1clj5uDjNLwYzCahHwIOPmQgoH04AyQIiWGbhCM= @@ -474,8 +458,6 @@ github.com/pelletier/go-toml/v2 v2.2.0 h1:QLgLl2yMN7N+ruc31VynXs1vhMZa7CeHHejIeB github.com/pelletier/go-toml/v2 v2.2.0/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= -github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M= -github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -513,8 +495,6 @@ github.com/prometheus/procfs v0.7.3 h1:4jVXhlkAyzOScmCkXBTOLRLTz8EeU+eyjrwB/EPq0 github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= github.com/quasilyte/go-ruleguard v0.4.2 h1:htXcXDK6/rO12kiTHKfHuqR4kr3Y4M0J0rOL6CH/BYs= github.com/quasilyte/go-ruleguard v0.4.2/go.mod h1:GJLgqsLeo4qgavUoL8JeGFNS7qcisx3awV/w9eWTmNI= -github.com/quasilyte/go-ruleguard v0.4.3-0.20240823090925-0fe6f58b47b1 h1:+Wl/0aFp0hpuHM3H//KMft64WQ1yX9LdJY64Qm/gFCo= -github.com/quasilyte/go-ruleguard v0.4.3-0.20240823090925-0fe6f58b47b1/go.mod h1:GJLgqsLeo4qgavUoL8JeGFNS7qcisx3awV/w9eWTmNI= github.com/quasilyte/go-ruleguard/dsl v0.3.22 h1:wd8zkOhSNr+I+8Qeciml08ivDt1pSXe60+5DqOpCjPE= github.com/quasilyte/go-ruleguard/dsl v0.3.22/go.mod h1:KeCP03KrjuSO0H1kTuZQCWlQPulDV6YMIXmpQss17rU= github.com/quasilyte/gogrep v0.5.0 h1:eTKODPXbI8ffJMN+W2aE0+oL0z/nh8/5eNdiO34SOAo= @@ -531,8 +511,6 @@ github.com/ryancurrah/gomodguard v1.3.2 h1:CuG27ulzEB1Gu5Dk5gP8PFxSOZ3ptSdP5iI/3 github.com/ryancurrah/gomodguard v1.3.2/go.mod h1:LqdemiFomEjcxOqirbQCb3JFvSxH2JUYMerTFd3sF2o= github.com/ryancurrah/gomodguard v1.3.3 h1:eiSQdJVNr9KTNxY2Niij8UReSwR8Xrte3exBrAZfqpg= github.com/ryancurrah/gomodguard v1.3.3/go.mod h1:rsKQjj4l3LXe8N344Ow7agAy5p9yjsWOtRzUMYmA0QY= -github.com/ryancurrah/gomodguard v1.3.5 h1:cShyguSwUEeC0jS7ylOiG/idnd1TpJ1LfHGpV3oJmPU= -github.com/ryancurrah/gomodguard v1.3.5/go.mod h1:MXlEPQRxgfPQa62O8wzK3Ozbkv9Rkqr+wKjSxTdsNJE= github.com/ryanrolds/sqlclosecheck v0.5.1 h1:dibWW826u0P8jNLsLN+En7+RqWWTYrjCB9fJfSfdyCU= github.com/ryanrolds/sqlclosecheck v0.5.1/go.mod h1:2g3dUjoS6AL4huFdv6wn55WpLIDjY7ZgUR4J8HOO/XQ= github.com/sanposhiho/wastedassign/v2 v2.0.7 h1:J+6nrY4VW+gC9xFzUc+XjPD3g3wF3je/NsJFwFK7Uxc= @@ -551,8 +529,6 @@ github.com/securego/gosec/v2 v2.19.0 h1:gl5xMkOI0/E6Hxx0XCY2XujA3V7SNSefA8sC+3f1 github.com/securego/gosec/v2 v2.19.0/go.mod h1:hOkDcHz9J/XIgIlPDXalxjeVYsHxoWUc5zJSHxcB8YM= github.com/securego/gosec/v2 v2.20.1-0.20240525090044-5f0084eb01a9 h1:rnO6Zp1YMQwv8AyxzuwsVohljJgp4L0ZqiCgtACsPsc= github.com/securego/gosec/v2 v2.20.1-0.20240525090044-5f0084eb01a9/go.mod h1:dg7lPlu/xK/Ut9SedURCoZbVCR4yC7fM65DtH9/CDHs= -github.com/securego/gosec/v2 v2.21.2 h1:deZp5zmYf3TWwU7A7cR2+SolbTpZ3HQiwFqnzQyEl3M= -github.com/securego/gosec/v2 v2.21.2/go.mod h1:au33kg78rNseF5PwPnTWhuYBFf534bvJRvOrgZ/bFzU= github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c h1:W65qqJCIOVP4jpqPQ0YvHYKwcMEMVWIzWC5iNQQfBTU= github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c/go.mod h1:/PevMnwAxekIXwN8qQyfc5gl2NlkB3CQlkizAbOkeBs= github.com/shurcooL/go v0.0.0-20180423040247-9e1955d9fb6e/go.mod h1:TDJrrUr11Vxrven61rcy3hJMUqaf/CLWYhHNPmT14Lk= @@ -616,16 +592,12 @@ github.com/tenntenn/modver v1.0.1/go.mod h1:bePIyQPb7UeioSRkw3Q0XeMhYZSMx9B8ePqg github.com/tenntenn/text/transform v0.0.0-20200319021203-7eef512accb3/go.mod h1:ON8b8w4BN/kE1EOhwT0o+d62W65a6aPw1nouo9LMgyY= github.com/tetafro/godot v1.4.16 h1:4ChfhveiNLk4NveAZ9Pu2AN8QZ2nkUGFuadM9lrr5D0= github.com/tetafro/godot v1.4.16/go.mod h1:2oVxTBSftRTh4+MVfUaUXR6bn2GDXCaMcOG4Dk3rfio= -github.com/tetafro/godot v1.4.17 h1:pGzu+Ye7ZUEFx7LHU0dAKmCOXWsPjl7qA6iMGndsjPs= -github.com/tetafro/godot v1.4.17/go.mod h1:2oVxTBSftRTh4+MVfUaUXR6bn2GDXCaMcOG4Dk3rfio= github.com/timakin/bodyclose v0.0.0-20230421092635-574207250966 h1:quvGphlmUVU+nhpFa4gg4yJyTRJ13reZMDHrKwYw53M= github.com/timakin/bodyclose v0.0.0-20230421092635-574207250966/go.mod h1:27bSVNWSBOHm+qRp1T9qzaIpsWEP6TbUnei/43HK+PQ= github.com/timonwong/loggercheck v0.9.4 h1:HKKhqrjcVj8sxL7K77beXh0adEm6DLjV/QOGeMXEVi4= github.com/timonwong/loggercheck v0.9.4/go.mod h1:caz4zlPcgvpEkXgVnAJGowHAMW2NwHaNlpS8xDbVhTg= github.com/tomarrell/wrapcheck/v2 v2.8.3 h1:5ov+Cbhlgi7s/a42BprYoxsr73CbdMUTzE3bRDFASUs= github.com/tomarrell/wrapcheck/v2 v2.8.3/go.mod h1:g9vNIyhb5/9TQgumxQyOEqDHsmGYcGsVMOx/xGkqdMo= -github.com/tomarrell/wrapcheck/v2 v2.9.0 h1:801U2YCAjLhdN8zhZ/7tdjB3EnAoRlJHt/s+9hijLQ4= -github.com/tomarrell/wrapcheck/v2 v2.9.0/go.mod h1:g9vNIyhb5/9TQgumxQyOEqDHsmGYcGsVMOx/xGkqdMo= github.com/tommy-muehle/go-mnd/v2 v2.5.1 h1:NowYhSdyE/1zwK9QCLeRb6USWdoif80Ie+v+yU8u1Zw= github.com/tommy-muehle/go-mnd/v2 v2.5.1/go.mod h1:WsUAkMJMYww6l/ufffCD3m+P7LEvr8TnZn9lwVDlgzw= github.com/ultraware/funlen v0.1.0 h1:BuqclbkY6pO+cvxoq7OsktIXZpgBSkYTQtmwhAK81vI= @@ -704,8 +676,6 @@ golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EH golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= golang.org/x/exp v0.0.0-20240103183307-be819d1f06fc h1:ao2WRsKSzW6KuUY9IWPwWahcHCgR0s52IfwutMfEbdM= golang.org/x/exp v0.0.0-20240103183307-be819d1f06fc/go.mod h1:iRJReGqOEeBhDZGkGbynYwcHlctCvnjTYIamk7uXpHI= -golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e h1:I88y4caeGeuDQxgdoFPUq097j7kNfw6uvuiNxUBfcBk= -golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e/go.mod h1:akd2r19cwCdwSwWeIdzYQGa/EZZyqcOdwWiwj5L5eKQ= golang.org/x/exp/typeparams v0.0.0-20220428152302-39d4317da171/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/exp/typeparams v0.0.0-20230203172020-98cc5a0785f9/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/exp/typeparams v0.0.0-20240314144324-c7f7c6466f7f h1:phY1HzDcf18Aq9A8KkmRtY9WvOFIxN8wgfvy6Zm1DV8= @@ -746,8 +716,6 @@ golang.org/x/mod v0.18.0 h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0= golang.org/x/mod v0.18.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/mod v0.20.0 h1:utOm6MM3R3dnawAiJgn0y+xvuYRsm1RKM/4giyfDgV0= golang.org/x/mod v0.20.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= -golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0= -golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -873,8 +841,6 @@ 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/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM= golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -895,8 +861,6 @@ golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -1050,8 +1014,6 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= -google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= -google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= 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= @@ -1080,12 +1042,8 @@ honnef.co/go/tools v0.4.7 h1:9MDAWxMoSnB6QoSqiVr7P5mtkT9pOc1kSxchzPCnqJs= honnef.co/go/tools v0.4.7/go.mod h1:+rnGS1THNh8zMwnd2oVOTL9QF6vmfyG6ZXBULae2uc0= honnef.co/go/tools v0.5.0 h1:29uoiIormS3Z6R+t56STz/oI4v+mB51TSmEOdJPgRnE= honnef.co/go/tools v0.5.0/go.mod h1:e9irvo83WDG9/irijV44wr3tbhcFeRnfpVlRqVwpzMs= -honnef.co/go/tools v0.5.1 h1:4bH5o3b5ZULQ4UrBmP+63W9r7qIkqJClEA9ko5YKx+I= -honnef.co/go/tools v0.5.1/go.mod h1:e9irvo83WDG9/irijV44wr3tbhcFeRnfpVlRqVwpzMs= mvdan.cc/gofumpt v0.6.0 h1:G3QvahNDmpD+Aek/bNOLrFR2XC6ZAdo62dZu65gmwGo= mvdan.cc/gofumpt v0.6.0/go.mod h1:4L0wf+kgIPZtcCWXynNS2e6bhmj73umwnuXSZarixzA= -mvdan.cc/gofumpt v0.7.0 h1:bg91ttqXmi9y2xawvkuMXyvAA/1ZGJqYAEGjXuP0JXU= -mvdan.cc/gofumpt v0.7.0/go.mod h1:txVFJy/Sc/mvaycET54pV8SW8gWxTlUuGHVEcncmNUo= mvdan.cc/unparam v0.0.0-20240104100049-c549a3470d14 h1:zCr3iRRgdk5eIikZNDphGcM6KGVTx3Yu+/Uu9Es254w= mvdan.cc/unparam v0.0.0-20240104100049-c549a3470d14/go.mod h1:ZzZjEpJDOmx8TdVU6umamY3Xy0UAQUI2DHbf05USVbI= mvdan.cc/unparam v0.0.0-20240427195214-063aff900ca1 h1:Nykk7fggxChwLK4rUPYESzeIwqsuxXXlFEAh5YhaMRo= diff --git a/.bingo/variables.env b/.bingo/variables.env index 0ea41453b58..2f31fa8a2e7 100644 --- a/.bingo/variables.env +++ b/.bingo/variables.env @@ -14,7 +14,7 @@ CUE="${GOBIN}/cue-v0.5.0" DRONE="${GOBIN}/drone-v1.5.0" -GOLANGCI_LINT="${GOBIN}/golangci-lint-v1.61.0" +GOLANGCI_LINT="${GOBIN}/golangci-lint-v1.60.1" JB="${GOBIN}/jb-v0.5.1" diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 65a29eedca8..e73292fbe07 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -60,7 +60,7 @@ /pkg/README.md @grafana/grafana-backend-group /pkg/ruleguard.rules.go @grafana/grafana-backend-group /.bra.toml @grafana/grafana-backend-group -/.golangci.yml @grafana/grafana-backend-group +/.golangci.toml @grafana/grafana-backend-group /build.go @grafana/grafana-backend-services-squad /scripts/modowners/ @grafana/grafana-backend-services-squad /scripts/go-workspace @grafana/grafana-app-platform-squad diff --git a/.github/workflows/go_lint.yml b/.github/workflows/go_lint.yml index 7914f3add76..d4ac5e49346 100644 --- a/.github/workflows/go_lint.yml +++ b/.github/workflows/go_lint.yml @@ -2,7 +2,6 @@ name: golangci-lint on: push: paths: - - apps/** - pkg/** - .github/workflows/go_lint.yml - go.* @@ -14,7 +13,6 @@ permissions: contents: read jobs: - lint-go: runs-on: ubuntu-latest steps: @@ -22,11 +20,13 @@ jobs: - uses: actions/setup-go@v5 with: go-version-file: ./go.mod + - run: CODEGEN_VERIFY=1 make gen-cue - run: make gen-go - name: golangci-lint uses: golangci/golangci-lint-action@v6 with: - version: v1.61.0 + version: v1.60.1 args: | - --verbose $(go list -m -f '{{.Dir}}' | xargs -I{} sh -c 'test ! -f {}/.nolint && echo {}/...') + --config .golangci.toml --max-same-issues=0 --max-issues-per-linter=0 --verbose $(./scripts/go-workspace/golangci-lint-includes.sh) + skip-cache: true install-mode: binary diff --git a/.golangci.toml b/.golangci.toml new file mode 100644 index 00000000000..693ce6bc26e --- /dev/null +++ b/.golangci.toml @@ -0,0 +1,315 @@ +[run] +timeout = "20m" +concurrency = 10 +allow-parallel-runners = true + +[linters-settings.exhaustive] +default-signifies-exhaustive = true + +[linters-settings.revive] +ignore-generated-header = false +severity = "warning" +confidence = 3 + +[linters-settings.depguard.rules.main] +allow = [] # allow all +deny = [ + { pkg = "io/ioutil", desc = "Deprecated: As of Go 1.16, the same functionality is now provided by package io or package os, and those implementations should be preferred in new code. See the specific function documentation for details." }, + { pkg = "gopkg.in/yaml.v2", desc = "Grafana packages are not allowed to depend on gopkg.in/yaml.v2 as gopkg.in/yaml.v3 is now available" }, + { pkg = "github.com/pkg/errors", desc = "Deprecated: Go 1.13 supports the functionality provided by pkg/errors in the standard library." }, + { pkg = "github.com/xorcare/pointer", desc = "Use pkg/util.Pointer instead, which is a generic one-liner alternative" }, + { pkg = "github.com/gofrs/uuid", desc = "Use github.com/google/uuid instead, which we already depend on." }, + { pkg = "github.com/bmizerany/assert", desc = "Use github.com/stretchr/testify/assert instead, which we already depend on." }, +] + +[linters-settings.depguard.rules.coreplugins] +deny = [ + { pkg = "github.com/grafana/grafana/pkg/api", desc = "Core plugins are not allowed to depend on Grafana core packages" }, + { pkg = "github.com/grafana/grafana/pkg/cmd", desc = "Core plugins are not allowed to depend on Grafana core packages" }, + { pkg = "github.com/grafana/grafana/pkg/cuectx", desc = "Core plugins are not allowed to depend on Grafana core packages" }, + { pkg = "github.com/grafana/grafana/pkg/extensions", desc = "Core plugins are not allowed to depend on Grafana core packages" }, + { pkg = "github.com/grafana/grafana/pkg/kinds", desc = "Core plugins are not allowed to depend on Grafana core packages" }, + { pkg = "github.com/grafana/grafana/pkg/middleware", desc = "Core plugins are not allowed to depend on Grafana core packages" }, + { pkg = "github.com/grafana/grafana/pkg/modules", desc = "Core plugins are not allowed to depend on Grafana core packages" }, + { pkg = "github.com/grafana/grafana/pkg/registry", desc = "Core plugins are not allowed to depend on Grafana core packages" }, + { pkg = "github.com/grafana/grafana/pkg/services", desc = "Core plugins are not allowed to depend on Grafana core packages" }, + { pkg = "github.com/grafana/grafana/pkg/build", desc = "Core plugins are not allowed to depend on Grafana core packages" }, + { pkg = "github.com/grafana/grafana/pkg/codegen", desc = "Core plugins are not allowed to depend on Grafana core packages" }, + { pkg = "github.com/grafana/grafana/pkg/events", desc = "Core plugins are not allowed to depend on Grafana core packages" }, + { pkg = "github.com/grafana/grafana/pkg/ifaces", desc = "Core plugins are not allowed to depend on Grafana core packages" }, + { pkg = "github.com/grafana/grafana/pkg/kindsysreport", desc = "Core plugins are not allowed to depend on Grafana core packages" }, + { pkg = "github.com/grafana/grafana/pkg/mocks", desc = "Core plugins are not allowed to depend on Grafana core packages" }, + { pkg = "github.com/grafana/grafana/pkg/plugins", desc = "Core plugins are not allowed to depend on Grafana core packages" }, + { pkg = "github.com/grafana/grafana/pkg/setting", desc = "Core plugins are not allowed to depend on Grafana core packages" }, + { pkg = "github.com/grafana/grafana/pkg/util", desc = "Core plugins are not allowed to depend on Grafana core packages" }, + { pkg = "github.com/grafana/grafana/pkg/bus", desc = "Core plugins are not allowed to depend on Grafana core packages" }, + { pkg = "github.com/grafana/grafana/pkg/components", desc = "Core plugins are not allowed to depend on Grafana core packages" }, + { pkg = "github.com/grafana/grafana/pkg/expr", desc = "Core plugins are not allowed to depend on Grafana core packages" }, + { pkg = "github.com/grafana/grafana/pkg/infra", desc = "Core plugins are not allowed to depend on Grafana core packages" }, + { pkg = "github.com/grafana/grafana/pkg/login", desc = "Core plugins are not allowed to depend on Grafana core packages" }, + { pkg = "github.com/grafana/grafana/pkg/models", desc = "Core plugins are not allowed to depend on Grafana core packages" }, + { pkg = "github.com/grafana/grafana/pkg/server", desc = "Core plugins are not allowed to depend on Grafana core packages" }, + { pkg = "github.com/grafana/grafana/pkg/tests", desc = "Core plugins are not allowed to depend on Grafana core packages" }, + { pkg = "github.com/grafana/grafana/pkg/web", desc = "Core plugins are not allowed to depend on Grafana core packages" }, + { pkg = "github.com/grafana/grafana/pkg/tsdb/intervalv2", desc = "Core plugins are not allowed to depend on Grafana core packages" }, +] +files = [ + "**/pkg/tsdb/grafana-pyroscope-datasource/*", + "**/pkg/tsdb/grafana-pyroscope-datasource/**/*", + "**/pkg/tsdb/grafana-testdata-datasource/*", + "**/pkg/tsdb/grafana-testdata-datasource/**/*", + "**/pkg/tsdb/azuremonitor/*", + "**/pkg/tsdb/azuremonitor/**/*", + "**/pkg/tsdb/cloud-monitoring/*", + "**/pkg/tsdb/cloud-monitoring/**/*", + "**/pkg/tsdb/mysql/*", + "**/pkg/tsdb/mysql/**/*", + "**/pkg/tsdb/parca/*", + "**/pkg/tsdb/parca/**/*", + "**/pkg/tsdb/tempo/*", + "**/pkg/tsdb/tempo/**/*", + "**/pkg/tsdb/cloudwatch/*", + "**/pkg/tsdb/cloudwatch/**/*", +] + +[linters-settings.depguard.rules.apiserver] +list-mode = "lax" +allow = [ + "github.com/grafana/grafana/pkg/apimachinery", + "github.com/grafana/grafana/pkg/apiserver", +] +deny = [ + { pkg = "github.com/grafana/grafana/pkg", desc = "apiserver is not allowed to import grafana core" } +] +files = [ + "**/pkg/apiserver/*", + "**/pkg/apiserver/**/*" +] + +[linters-settings.depguard.rules.apimachinery] +list-mode = "lax" +allow = [ + "github.com/grafana/grafana/pkg/apimachinery", +] +deny = [ + { pkg = "github.com/grafana/grafana/pkg", desc = "apimachinery is not allowed to import grafana core" } +] +files = [ + "**/pkg/apimachinery/*", + "**/pkg/apimachinery/**/*" +] + +[linters-settings.depguard.rules.aggregator] +list-mode = "lax" +allow = [ + "github.com/grafana/grafana/pkg/aggregator", + "github.com/grafana/grafana/pkg/semconv", + "github.com/grafana/grafana/pkg/apimachinery", +] +deny = [ + { pkg = "github.com/grafana/grafana/pkg", desc = "apimachinery is not allowed to import grafana core" } +] +files = [ + "./pkg/aggregator/*", + "./pkg/aggregator/**/*" +] + +[linters-settings.depguard.rules.promlib] +list-mode = "lax" # allow unless explicitely denied +deny = [ + { pkg = "github.com/grafana/grafana/pkg", desc = "promlib is not allowed to import grafana core" } +] +allow = [ + "github.com/grafana/grafana/pkg/promlib" +] +files = [ + "**/pkg/promlib/**/*" +] + +[linters-settings.depguard.rules.storage-unified-resource] +list-mode = "lax" +allow = [ + "github.com/grafana/grafana/pkg/apimachinery", +] +deny = [ + { pkg = "github.com/grafana/grafana/pkg", desc = "pkg/storage/unified/resource is not allowed to import grafana core" } +] +files = [ + "./pkg/storage/unified/resource/*", + "./pkg/storage/unified/resource/**/*" +] + +[linters-settings.depguard.rules.storage-unified-apistore] +list-mode = "lax" +allow = [ + "github.com/grafana/grafana/pkg/apimachinery", + "github.com/grafana/grafana/pkg/apiserver", + "github.com/grafana/grafana/pkg/unified/resource", +] +deny = [ + { pkg = "github.com/grafana/grafana/pkg", desc = "pkg/storage/unified/apistore is not allowed to import grafana core" } +] +files = [ + "./pkg/storage/unified/apistore/*", + "./pkg/storage/unified/apistore/**/*" +] + +[linters-settings.depguard.rules.apps-playlist] +list-mode = "lax" +allow = [] +deny = [ + { pkg = "github.com/grafana/grafana/pkg", desc = "apps/playlist is not allowed to import grafana core" } +] +files = [ + "./apps/playlist/*", + "./apps/playlist/**/*" +] + +[linters-settings.gocritic] +enabled-checks = ["ruleguard"] +[linters-settings.gocritic.settings.ruleguard] +rules = "pkg/ruleguard.rules.go" + +[linters-settings.misspell] +ignore-words = ["Unknwon", "Creater"] + +[linters-settings.nakedret] +max-func-lines = 60 + +[linters] +disable-all = true +# try to keep this list sorted, please +enable = [ + "asciicheck", + "bodyclose", + "depguard", + "dogsled", + "errcheck", + "errorlint", + "exhaustive", + "exportloopref", + # "gochecknoinits", + # "goconst", + # "gocritic", # Temporarily disabled on 2022-09-09, running into weird bug "ruleguard: execution error: used Run() with an empty rule set; forgot to call Load() first?" + "gocyclo", + "goimports", + "goprintffuncname", + "gosec", + "gosimple", + "govet", + "ineffassign", + "misspell", + "nakedret", + "prealloc", + "revive", + "staticcheck", + "stylecheck", + "unconvert", + "unused", + "whitespace", +] + +# Disabled linters (might want them later) +# "unparam" +# "rowserrcheck" # The linter doesn't detect that both Scan and Close also returns the error message returned by Err. + +[issues] +exclude-use-default = false +max-same-issues = 0 + +# Enable when appropriate +# Poorly chosen identifier +[[issues.exclude-rules]] +linters = ["stylecheck"] +text = "ST1003" + +# Enable when appropriate +# Dot imports that aren't in external test packages are discouraged. +[[issues.exclude-rules]] +linters = ["stylecheck"] +text = "ST1001" + +# Enable when appropriate +# http.CloseNotifier has been deprecated since Go 1.11 and an alternative has been available since Go 1.7: We currently need it in pkg/web/response_writer.go. +[[issues.exclude-rules]] +linters = ["staticcheck"] +text = "SA1019: http.CloseNotifier" + +# strings.Title has been deprecated since Go 1.18 and an alternative has been available since Go 1.0: The rule Title uses for word boundaries does not handle Unicode punctuation properly. +# Use golang.org/x/text/cases instead. +[[issues.exclude-rules]] +linters = ["staticcheck"] +text = "SA1019: strings.Title" + +# go.opentelemetry.io/otel/exporters/jaeger" is deprecated: This module is no longer supported. OpenTelemetry dropped support for Jaeger exporter in July 2023. +# Jaeger officially accepts and recommends using OTLP. +# Use [go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp] or [go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc] instead. +[[issues.exclude-rules]] +linters = ["staticcheck"] +text = "SA1019: \"go.opentelemetry.io/otel/exporters/jaeger\"" + +[[issues.exclude-rules]] +linters = ["staticcheck"] +text = "use fake service and real access control evaluator instead" + +[[issues.exclude-rules]] +linters = ["gosec"] +text = "G108" + +[[issues.exclude-rules]] +linters = ["gosec"] +text = "G110" + +[[issues.exclude-rules]] +linters = ["gosec"] +text = "G201" + +[[issues.exclude-rules]] +linters = ["gosec"] +text = "G202" + +[[issues.exclude-rules]] +linters = ["gosec"] +text = "G306" + +[[issues.exclude-rules]] +linters = ["gosec"] +text = "401" + +[[issues.exclude-rules]] +linters = ["gosec"] +text = "402" + +[[issues.exclude-rules]] +linters = ["gosec"] +text = "501" + +[[issues.exclude-rules]] +linters = ["gosec"] +text = "404" + +[[issues.exclude-rules]] +linters = ["errorlint"] +text = "non-wrapping format verb for fmt.Errorf" + +# TODO: Enable +[[issues.exclude-rules]] +linters = ["stylecheck"] +text = "ST1000" + +# TODO: Enable +[[issues.exclude-rules]] +linters = ["stylecheck"] +text = "ST1020" + +# TODO: Enable +[[issues.exclude-rules]] +linters = ["stylecheck"] +text = "ST1021" + +# Remove this when we have go v1.22 in place +# https://stackoverflow.com/a/68247837/767660 +[[issues.exclude-rules]] +linters = ["gosec"] +path = '(.+)_test\.go' +text = "G601" diff --git a/.golangci.yml b/.golangci.yml deleted file mode 100644 index d967e0c33f9..00000000000 --- a/.golangci.yml +++ /dev/null @@ -1,301 +0,0 @@ -run: - timeout: 10m - concurrency: 10 - allow-parallel-runners: true -linters-settings: - exhaustive: - default-signifies-exhaustive: true - revive: - ignore-generated-header: false - severity: warning - confidence: 3 - depguard: - rules: - main: - allow: [] - deny: - - pkg: io/ioutil - desc: >- - Deprecated: As of Go 1.16, the same functionality is now provided - by package io or package os, and those implementations should be - preferred in new code. See the specific function documentation for - details. - - pkg: gopkg.in/yaml.v2 - desc: >- - Grafana packages are not allowed to depend on gopkg.in/yaml.v2 as - gopkg.in/yaml.v3 is now available - - pkg: github.com/pkg/errors - desc: >- - Deprecated: Go 1.13 supports the functionality provided by - pkg/errors in the standard library. - - pkg: github.com/xorcare/pointer - desc: >- - Use pkg/util.Pointer instead, which is a generic one-liner - alternative - - pkg: github.com/gofrs/uuid - desc: 'Use github.com/google/uuid instead, which we already depend on.' - - pkg: github.com/bmizerany/assert - desc: >- - Use github.com/stretchr/testify/assert instead, which we already - depend on. - coreplugins: - deny: - - pkg: github.com/grafana/grafana/pkg/api - desc: Core plugins are not allowed to depend on Grafana core packages - - pkg: github.com/grafana/grafana/pkg/cmd - desc: Core plugins are not allowed to depend on Grafana core packages - - pkg: github.com/grafana/grafana/pkg/cuectx - desc: Core plugins are not allowed to depend on Grafana core packages - - pkg: github.com/grafana/grafana/pkg/extensions - desc: Core plugins are not allowed to depend on Grafana core packages - - pkg: github.com/grafana/grafana/pkg/kinds - desc: Core plugins are not allowed to depend on Grafana core packages - - pkg: github.com/grafana/grafana/pkg/middleware - desc: Core plugins are not allowed to depend on Grafana core packages - - pkg: github.com/grafana/grafana/pkg/modules - desc: Core plugins are not allowed to depend on Grafana core packages - - pkg: github.com/grafana/grafana/pkg/registry - desc: Core plugins are not allowed to depend on Grafana core packages - - pkg: github.com/grafana/grafana/pkg/services - desc: Core plugins are not allowed to depend on Grafana core packages - - pkg: github.com/grafana/grafana/pkg/build - desc: Core plugins are not allowed to depend on Grafana core packages - - pkg: github.com/grafana/grafana/pkg/codegen - desc: Core plugins are not allowed to depend on Grafana core packages - - pkg: github.com/grafana/grafana/pkg/events - desc: Core plugins are not allowed to depend on Grafana core packages - - pkg: github.com/grafana/grafana/pkg/ifaces - desc: Core plugins are not allowed to depend on Grafana core packages - - pkg: github.com/grafana/grafana/pkg/kindsysreport - desc: Core plugins are not allowed to depend on Grafana core packages - - pkg: github.com/grafana/grafana/pkg/mocks - desc: Core plugins are not allowed to depend on Grafana core packages - - pkg: github.com/grafana/grafana/pkg/plugins - desc: Core plugins are not allowed to depend on Grafana core packages - - pkg: github.com/grafana/grafana/pkg/setting - desc: Core plugins are not allowed to depend on Grafana core packages - - pkg: github.com/grafana/grafana/pkg/util - desc: Core plugins are not allowed to depend on Grafana core packages - - pkg: github.com/grafana/grafana/pkg/bus - desc: Core plugins are not allowed to depend on Grafana core packages - - pkg: github.com/grafana/grafana/pkg/components - desc: Core plugins are not allowed to depend on Grafana core packages - - pkg: github.com/grafana/grafana/pkg/expr - desc: Core plugins are not allowed to depend on Grafana core packages - - pkg: github.com/grafana/grafana/pkg/infra - desc: Core plugins are not allowed to depend on Grafana core packages - - pkg: github.com/grafana/grafana/pkg/login - desc: Core plugins are not allowed to depend on Grafana core packages - - pkg: github.com/grafana/grafana/pkg/models - desc: Core plugins are not allowed to depend on Grafana core packages - - pkg: github.com/grafana/grafana/pkg/server - desc: Core plugins are not allowed to depend on Grafana core packages - - pkg: github.com/grafana/grafana/pkg/tests - desc: Core plugins are not allowed to depend on Grafana core packages - - pkg: github.com/grafana/grafana/pkg/web - desc: Core plugins are not allowed to depend on Grafana core packages - - pkg: github.com/grafana/grafana/pkg/tsdb/intervalv2 - desc: Core plugins are not allowed to depend on Grafana core packages - files: - - '**/pkg/tsdb/grafana-pyroscope-datasource/*' - - '**/pkg/tsdb/grafana-pyroscope-datasource/**/*' - - '**/pkg/tsdb/grafana-testdata-datasource/*' - - '**/pkg/tsdb/grafana-testdata-datasource/**/*' - - '**/pkg/tsdb/azuremonitor/*' - - '**/pkg/tsdb/azuremonitor/**/*' - - '**/pkg/tsdb/cloud-monitoring/*' - - '**/pkg/tsdb/cloud-monitoring/**/*' - - '**/pkg/tsdb/mysql/*' - - '**/pkg/tsdb/mysql/**/*' - - '**/pkg/tsdb/parca/*' - - '**/pkg/tsdb/parca/**/*' - - '**/pkg/tsdb/tempo/*' - - '**/pkg/tsdb/tempo/**/*' - - '**/pkg/tsdb/cloudwatch/*' - - '**/pkg/tsdb/cloudwatch/**/*' - apiserver: - list-mode: lax - allow: - - github.com/grafana/grafana/pkg/apimachinery - - github.com/grafana/grafana/pkg/apiserver - deny: - - pkg: github.com/grafana/grafana/pkg - desc: apiserver is not allowed to import grafana core - files: - - '**/pkg/apiserver/*' - - '**/pkg/apiserver/**/*' - apimachinery: - list-mode: lax - allow: - - github.com/grafana/grafana/pkg/apimachinery - deny: - - pkg: github.com/grafana/grafana/pkg - desc: apimachinery is not allowed to import grafana core - files: - - '**/pkg/apimachinery/*' - - '**/pkg/apimachinery/**/*' - aggregator: - list-mode: lax - allow: - - github.com/grafana/grafana/pkg/aggregator - - github.com/grafana/grafana/pkg/semconv - - github.com/grafana/grafana/pkg/apimachinery - deny: - - pkg: github.com/grafana/grafana/pkg - desc: apimachinery is not allowed to import grafana core - files: - - ./pkg/aggregator/* - - ./pkg/aggregator/**/* - promlib: - list-mode: lax - deny: - - pkg: github.com/grafana/grafana/pkg - desc: promlib is not allowed to import grafana core - allow: - - github.com/grafana/grafana/pkg/promlib - files: - - '**/pkg/promlib/**/*' - storage-unified-resource: - list-mode: lax - allow: - - github.com/grafana/grafana/pkg/apimachinery - deny: - - pkg: github.com/grafana/grafana/pkg - desc: pkg/storage/unified/resource is not allowed to import grafana core - files: - - ./pkg/storage/unified/resource/* - - ./pkg/storage/unified/resource/**/* - storage-unified-apistore: - list-mode: lax - allow: - - github.com/grafana/grafana/pkg/apimachinery - - github.com/grafana/grafana/pkg/apiserver - - github.com/grafana/grafana/pkg/unified/resource - deny: - - pkg: github.com/grafana/grafana/pkg - desc: pkg/storage/unified/apistore is not allowed to import grafana core - files: - - ./pkg/storage/unified/apistore/* - - ./pkg/storage/unified/apistore/**/* - apps-playlist: - list-mode: lax - allow: [] - deny: - - pkg: github.com/grafana/grafana/pkg - desc: apps/playlist is not allowed to import grafana core - files: - - ./apps/playlist/* - - ./apps/playlist/**/* - gocritic: - enabled-checks: - - ruleguard - settings: - ruleguard: - rules: pkg/ruleguard.rules.go - misspell: - ignore-words: - - Unknwon - - Creater - nakedret: - max-func-lines: 60 -linters: - disable-all: true - enable: - - asciicheck - - bodyclose - - depguard - - dogsled - - errcheck - - errorlint - - exhaustive - - gocyclo - - goimports - - goprintffuncname - - gosec - - gosimple - - govet - - ineffassign - - misspell - - nakedret - - prealloc - - revive - - staticcheck - - stylecheck - - unconvert - - unused - - whitespace -issues: - exclude-use-default: false - max-same-issues: 0 - exclude-dirs: - - devenv - - scripts - exclude-files: - - pkg/util/xorm/*.go - - pkg/build/wire/*.go - exclude-rules: - - linters: - - stylecheck - text: ST1003 - - linters: - - stylecheck - text: ST1001 - - linters: - - staticcheck - text: 'SA1019: http.CloseNotifier' - - linters: - - staticcheck - text: 'SA1019: strings.Title' - - linters: - - staticcheck - text: 'SA1019: "go.opentelemetry.io/otel/exporters/jaeger"' - - linters: - - staticcheck - text: use fake service and real access control evaluator instead - - linters: - - gosec - text: G108 - - linters: - - gosec - text: G110 - - linters: - - gosec - text: G115 - - linters: - - gosec - text: G201 - - linters: - - gosec - text: G202 - - linters: - - gosec - text: G306 - - linters: - - gosec - text: '401' - - linters: - - gosec - text: '402' - - linters: - - gosec - text: '501' - - linters: - - gosec - text: '404' - - linters: - - errorlint - text: non-wrapping format verb for fmt.Errorf - - linters: - - stylecheck - text: ST1000 - - linters: - - stylecheck - text: ST1020 - - linters: - - stylecheck - text: ST1021 - - linters: - - gosec - path: (.+)_test\.go - text: G601 - diff --git a/devenv/docker/ha-test-unified-alerting/webhook-listener.go b/devenv/docker/ha-test-unified-alerting/webhook-listener.go index 0eab9484b8f..d14617dca06 100644 --- a/devenv/docker/ha-test-unified-alerting/webhook-listener.go +++ b/devenv/docker/ha-test-unified-alerting/webhook-listener.go @@ -104,7 +104,6 @@ func main() { _, err := os.Stat(dumpDir) if os.IsNotExist(err) { - // nolint:gosec err = os.MkdirAll(dumpDir, os.ModePerm) if err != nil { log.Panicf("can't create directory '%s'", dumpDir) @@ -113,12 +112,10 @@ func main() { if logFile { //create your file with desired read/write permissions - // nolint:gosec f, err := os.OpenFile(logFileName, os.O_WRONLY|os.O_CREATE|os.O_APPEND, os.ModePerm) if err != nil { log.Fatal(err) } - // nolint:errcheck defer f.Close() log.SetOutput(f) } @@ -126,7 +123,6 @@ func main() { waitDuration := time.Duration(waitSeconds) * time.Second http.HandleFunc("/", func(writer http.ResponseWriter, request *http.Request) { writer.WriteHeader(http.StatusOK) - // nolint:errcheck writer.Write([]byte(landingPage)) }) @@ -161,12 +157,10 @@ func main() { return } w.Header().Add("Content-Type", "application/json") - // nolint:errcheck w.Write(b) }) log.Println("Listening") log.Printf("Wait Duration %v\n", waitDuration) - // nolint:errcheck http.ListenAndServe("0.0.0.0:8080", nil) } diff --git a/pkg/build/wire/.nolint b/pkg/build/wire/.nolint deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/pkg/util/xorm/.nolint b/pkg/util/xorm/.nolint deleted file mode 100644 index e69de29bb2d..00000000000