From b46e392adbbb59f40fecd16c9ff925cb40456e0c Mon Sep 17 00:00:00 2001 From: Trevor Whitney Date: Mon, 13 Mar 2023 16:02:09 -0600 Subject: [PATCH] gofmt is needed for the build (#8678) **What this PR does / why we need it**: `gofmt` is needed for the build, `make format` fails without it. --- .golangci.yml | 11 +++-- flake.nix | 1 + nix/faillint.nix | 6 +-- pkg/ruler/base/ruler.go | 4 -- .../chunk/client/aws/s3_storage_client.go | 1 - .../indexshipper/compactor/compactor_test.go | 49 ------------------- pkg/util/log/line_buffer_test.go | 1 - tools/doc-generator/main.go | 33 ------------- 8 files changed, 11 insertions(+), 95 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 08340a1609..5e2e2396b2 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -19,7 +19,10 @@ run: tests: true # list of build tags, all linters use it. Default is empty list. - build-tags: [] + build-tags: + - linux + - cgo + - promtail_journal_enabled # which dirs to skip: they won't be analyzed; # can use regexp here: generated.*, regexp is applied on full path; @@ -33,9 +36,9 @@ run: # no need to include all autogenerated files, we confidently recognize # autogenerated files. If it's not please let us know. skip-files: - - .*.pb.go - - .*.y.go - - .*.rl.go + - .*.pb.go + - .*.y.go + - .*.rl.go # output configuration options output: # colored-line-number|line-number|json|tab|checkstyle, default is "colored-line-number" diff --git a/flake.nix b/flake.nix index 055a073387..5fdf9e97b2 100644 --- a/flake.nix +++ b/flake.nix @@ -145,6 +145,7 @@ nettools golangci-lint + gotools helm-docs faillint chart-testing diff --git a/nix/faillint.nix b/nix/faillint.nix index 8aeedc41bd..58d0bd9374 100644 --- a/nix/faillint.nix +++ b/nix/faillint.nix @@ -2,15 +2,15 @@ buildGoModule rec { pname = "faillint"; - version = "1.10.0"; + version = "1.11.0"; src = fetchFromGitHub { owner = "fatih"; repo = "faillint"; rev = "v${version}"; - sha256 = "0y8m39iir7cry3svmwvv9fbfld6y5k6asimmhs0f4rk8f9czriv8"; + sha256 = "ZSTeNp8r+Ab315N1eVDbZmEkpQUxmmVovvtqBBskuI4="; }; - vendorSha256 = "yN8KHpHfBN9Gv6BVdA5AQhYSJ7fwH9k9ZgkuNYHF0kc="; + vendorSha256 = "5OR6Ylkx8AnDdtweY1B9OEcIIGWsY8IwTHbR/LGnqFI="; doCheck = false; } diff --git a/pkg/ruler/base/ruler.go b/pkg/ruler/base/ruler.go index 8800894211..9b49779483 100644 --- a/pkg/ruler/base/ruler.go +++ b/pkg/ruler/base/ruler.go @@ -45,10 +45,6 @@ import ( var ( supportedShardingStrategies = []string{util.ShardingStrategyDefault, util.ShardingStrategyShuffle} supportedShardingAlgos = []string{util.ShardingAlgoByGroup, util.ShardingAlgoByRule} - - // Validation errors. - errInvalidShardingStrategy = errors.New("invalid sharding strategy") - errInvalidTenantShardSize = errors.New("invalid tenant shard size, the value must be greater than 0") ) const ( diff --git a/pkg/storage/chunk/client/aws/s3_storage_client.go b/pkg/storage/chunk/client/aws/s3_storage_client.go index a1f1b25f0d..dea83dee6e 100644 --- a/pkg/storage/chunk/client/aws/s3_storage_client.go +++ b/pkg/storage/chunk/client/aws/s3_storage_client.go @@ -45,7 +45,6 @@ const ( var ( supportedSignatureVersions = []string{SignatureVersionV4, SignatureVersionV2} errUnsupportedSignatureVersion = errors.New("unsupported signature version") - errUnsupportedStorageClass = errors.New("unsupported S3 storage class") ) var s3RequestDuration = instrument.NewHistogramCollector(prometheus.NewHistogramVec(prometheus.HistogramOpts{ diff --git a/pkg/storage/stores/indexshipper/compactor/compactor_test.go b/pkg/storage/stores/indexshipper/compactor/compactor_test.go index b958cfc251..c905514dc6 100644 --- a/pkg/storage/stores/indexshipper/compactor/compactor_test.go +++ b/pkg/storage/stores/indexshipper/compactor/compactor_test.go @@ -32,55 +32,6 @@ func dayFromTime(t model.Time) config.DayTime { var ( start = model.Now().Add(-30 * 24 * time.Hour) - schemaCfg = config.SchemaConfig{ - // we want to test over all supported schema. - Configs: []config.PeriodConfig{ - { - From: dayFromTime(start), - IndexType: "boltdb", - ObjectType: "filesystem", - Schema: "v9", - IndexTables: config.PeriodicTableConfig{ - Prefix: indexTablePrefix, - Period: time.Hour * 24, - }, - RowShards: 16, - }, - { - From: dayFromTime(start.Add(25 * time.Hour)), - IndexType: "boltdb", - ObjectType: "filesystem", - Schema: "v10", - IndexTables: config.PeriodicTableConfig{ - Prefix: indexTablePrefix, - Period: time.Hour * 24, - }, - RowShards: 16, - }, - { - From: dayFromTime(start.Add(73 * time.Hour)), - IndexType: "boltdb", - ObjectType: "filesystem", - Schema: "v11", - IndexTables: config.PeriodicTableConfig{ - Prefix: indexTablePrefix, - Period: time.Hour * 24, - }, - RowShards: 16, - }, - { - From: dayFromTime(start.Add(100 * time.Hour)), - IndexType: "boltdb", - ObjectType: "filesystem", - Schema: "v12", - IndexTables: config.PeriodicTableConfig{ - Prefix: indexTablePrefix, - Period: time.Hour * 24, - }, - RowShards: 16, - }, - }, - } ) func setupTestCompactor(t *testing.T, tempDir string) *Compactor { diff --git a/pkg/util/log/line_buffer_test.go b/pkg/util/log/line_buffer_test.go index 4338da65ea..b4c6095c82 100644 --- a/pkg/util/log/line_buffer_test.go +++ b/pkg/util/log/line_buffer_test.go @@ -176,5 +176,4 @@ func benchmarkRunner(b *testing.B, logger log.Logger, f func(log.Logger)) { var ( baseMessage = func(logger log.Logger) { logger.Log("foo_key", "foo_value") } - withMessage = func(logger log.Logger) { log.With(logger, "a", "b").Log("c", "d") } ) diff --git a/tools/doc-generator/main.go b/tools/doc-generator/main.go index e2b9507a91..3d28f91eaa 100644 --- a/tools/doc-generator/main.go +++ b/tools/doc-generator/main.go @@ -99,39 +99,6 @@ func generateBlocksMarkdown(blocks []*parse.ConfigBlock) string { return md.string() } -func generateBlockMarkdown(blocks []*parse.ConfigBlock, blockName, fieldName string) string { - // Look for the requested block. - for _, block := range blocks { - if block.Name != blockName { - continue - } - - md := &markdownWriter{} - - // Wrap the root block with another block, so that we can show the name of the - // root field containing the block specs. - md.writeConfigBlock(&parse.ConfigBlock{ - Name: blockName, - Desc: block.Desc, - Entries: []*parse.ConfigEntry{ - { - Kind: parse.KindBlock, - Name: fieldName, - Required: true, - Block: block, - BlockDesc: "", - Root: false, - }, - }, - }) - - return md.string() - } - - // If the block has not been found, we return an empty string. - return "" -} - func main() { // Parse the generator flags. flag.Parse()