Bump golangci-lint to 1.55.2 and fix issues

Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
This commit is contained in:
Khosrow Moossavi
2023-12-19 12:51:04 -05:00
parent 4552242276
commit 5cfb2f2615
11 changed files with 108 additions and 111 deletions

View File

@@ -1,8 +1,6 @@
run:
timeout: 10m
deadline: 5m
tests: true
tests: false
output:
format: tab
@@ -100,7 +98,7 @@ linters:
- goimports
- gofmt # We enable this as well as goimports for its simplify mode.
- prealloc
- golint
# - golint # deprecated as of upgrading to 1.55.2
- unconvert
- misspell
- nakedret

View File

@@ -38,7 +38,7 @@ DOCKER_IMAGE := quay.io/$(PROJECT_OWNER)/$(PROJECT_NAME)
DOCKER_TAG ?= $(DEFAULT_TAG)
# Binary versions
GOLANGCI_VERSION := v1.47.2
GOLANGCI_VERSION := v1.55.2
.PHONY: all
all: clean verify checkfmt lint test build

View File

@@ -10,7 +10,7 @@ the root directory of this source tree.
// Package format provides different, out of the box supported, output format types.
//
// Usage
// # Usage
//
// A specific format can be instantiated either with `format.New()` function or
// directly calling its function (e.g. `NewMarkdownTable`, etc)
@@ -53,5 +53,4 @@ the root directory of this source tree.
// • `NewTOML`
// • `NewXML`
// • `NewYAML`
//
package format

View File

@@ -135,6 +135,8 @@ type generator struct {
// newGenerator returns a generator for specific formatter name and with
// provided sets of GeneratorFunc functions to build and add individual
// sections.
//
//nolint:unparam
func newGenerator(config *print.Config, canRender bool, fns ...generateFunc) *generator {
g := &generator{
config: config,

View File

@@ -286,7 +286,7 @@ func (l List) Raw() interface{} {
}
type xmllistentry struct {
XMLName xml.Name
XMLName xml.Name `xml:"item"`
Value interface{} `xml:",chardata"`
}
@@ -334,7 +334,7 @@ func (m Map) Length() int {
}
type xmlmapentry struct {
XMLName xml.Name
XMLName xml.Name `xml:","`
Value interface{} `xml:",chardata"`
}

View File

@@ -19,7 +19,7 @@ the root directory of this source tree.
// Implementation details are hidden in go-plugin. This package is
// essentially a wrapper for go-plugin.
//
// Usage
// # Usage
//
// A simple plugin can look like this:
//
@@ -58,5 +58,4 @@ the root directory of this source tree.
//
// return rendered, nil
// }
//
package plugin

View File

@@ -10,7 +10,7 @@ the root directory of this source tree.
// Package print provides configuration, and a Generator.
//
// Configuration
// # Configuration
//
// `print.Config` is the data structure representation for `.terraform-docs.yml`
// which will be read and extracted upon execution of terraform-docs cli. On the
@@ -24,7 +24,7 @@ the root directory of this source tree.
//
// config := print.NewConfig()
//
// Generator
// # Generator
//
// `Generator` is an abstract implementation of `format.Type`. It doesn't implement
// `Generate(*terraform.Module) error` function. It is used directly by different
@@ -46,5 +46,4 @@ the root directory of this source tree.
// • `{{ .Requirements }}`
// • `{{ .Resources }}`
// • `{{ include "path/fo/file" }}`
//
package print

View File

@@ -19,6 +19,7 @@ func contains(list []string, name string) bool {
return false
}
// nolint
func index(list []string, name string) int {
for i, v := range list {
if v == name {
@@ -28,6 +29,7 @@ func index(list []string, name string) int {
return -1
}
// nolint
func remove(list []string, name string) []string {
index := index(list, name)
if index < 0 {

View File

@@ -200,7 +200,7 @@ func example(ref *reference) error {
if s == "" {
buf.WriteString("\n")
} else {
buf.WriteString(fmt.Sprintf(" %s\n", s))
fmt.Fprintf(buf, " %s\n", s)
}
}
ref.Example = buf.String()

View File

@@ -50,5 +50,4 @@ the root directory of this source tree.
//
// return tt.Render("main", module)
// }
//
package template

View File

@@ -48,5 +48,4 @@ the root directory of this source tree.
// }
//
// ...
//
package terraform