Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update to go1.23, update golangci-lint to v1.62, fix linting issues #60

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.20"
go-version: "1.23"
-
name: Download modules
run: |
Expand Down
13 changes: 5 additions & 8 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ run:

linters:
enable:
- deadcode
- depguard
- gofmt
- goimports
Expand All @@ -13,20 +12,18 @@ linters:
- ineffassign
- misspell
- typecheck
- varcheck
- errname
- makezero
- whitespace
disable-all: true

linters-settings:
depguard:
list-type: blacklist
include-go-root: true
packages:
# The io/ioutil package has been deprecated.
# https://go.dev/doc/go1.16#ioutil
- io/ioutil
rules:
main:
deny:
- pkg: io/ioutil
desc: The io/ioutil package has been deprecated, see https://go.dev/doc/go1.16#ioutil
importas:
no-unaliased: true

Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

ARG GO_VERSION="1.18"
ARG GOLANGCI_LINT_VERSION="v1.45"
ARG GO_VERSION="1.23"
ARG GOLANGCI_LINT_VERSION="v1.62"
ARG ADDLICENSE_VERSION="v1.0.0"

ARG LICENSE_ARGS="-c cli-docs-tool -l apache"
Expand Down
4 changes: 2 additions & 2 deletions clidocstool_man_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func TestGenManTree(t *testing.T) {
seen := make(map[string]struct{})
remanpage := regexp.MustCompile(`\.\d+$`)

filepath.Walk("fixtures", func(path string, info fs.FileInfo, err error) error {
_ = filepath.Walk("fixtures", func(path string, info fs.FileInfo, _ error) error {
fname := filepath.Base(path)
// ignore dirs and any file that is not a manpage
if info.IsDir() || !remanpage.MatchString(fname) {
Expand All @@ -77,7 +77,7 @@ func TestGenManTree(t *testing.T) {
return nil
})

filepath.Walk(tmpdir, func(path string, info fs.FileInfo, err error) error {
_ = filepath.Walk(tmpdir, func(path string, info fs.FileInfo, _ error) error {
fname := filepath.Base(path)
// ignore dirs and any file that is not a manpage
if info.IsDir() || !remanpage.MatchString(fname) {
Expand Down
4 changes: 2 additions & 2 deletions clidocstool_md_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func TestGenMarkdownTree(t *testing.T) {

seen := make(map[string]struct{})

filepath.Walk("fixtures", func(path string, info fs.FileInfo, err error) error {
_ = filepath.Walk("fixtures", func(path string, info fs.FileInfo, _ error) error {
fname := filepath.Base(path)
// ignore dirs, .pre.md files and any file that is not a .md file
if info.IsDir() || !strings.HasSuffix(fname, ".md") || strings.HasSuffix(fname, ".pre.md") {
Expand All @@ -62,7 +62,7 @@ func TestGenMarkdownTree(t *testing.T) {
return nil
})

filepath.Walk(tmpdir, func(path string, info fs.FileInfo, err error) error {
_ = filepath.Walk(tmpdir, func(path string, info fs.FileInfo, _ error) error {
fname := filepath.Base(path)
// ignore dirs, .pre.md files and any file that is not a .md file
if info.IsDir() || !strings.HasSuffix(fname, ".md") || strings.HasSuffix(fname, ".pre.md") {
Expand Down
16 changes: 8 additions & 8 deletions clidocstool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func setup() {
SilenceUsage: true,
SilenceErrors: true,
TraverseChildren: true,
Run: func(cmd *cobra.Command, args []string) {},
Run: func(*cobra.Command, []string) {},
Version: "20.10.8",
DisableFlagsInUseLine: true,
}
Expand All @@ -65,7 +65,7 @@ func setup() {
Annotations: map[string]string{
"aliases": "docker container attach, docker attach",
},
Run: func(cmd *cobra.Command, args []string) {},
Run: func(*cobra.Command, []string) {},
}

attachFlags := attachCmd.Flags()
Expand All @@ -86,7 +86,7 @@ func setup() {
Use: "build [OPTIONS] PATH | URL | -",
Aliases: []string{"b"},
Short: "Start a build",
Run: func(cmd *cobra.Command, args []string) {},
Run: func(*cobra.Command, []string) {},
Annotations: map[string]string{
"aliases": "docker image build, docker buildx build, docker buildx b, docker build",
},
Expand All @@ -95,19 +95,19 @@ func setup() {
Use: "dial-stdio",
Short: "Proxy current stdio streams to builder instance",
Args: cobra.NoArgs,
Run: func(cmd *cobra.Command, args []string) {},
Run: func(*cobra.Command, []string) {},
}
buildxInstallCmd = &cobra.Command{
Use: "install",
Short: "Install buildx as a 'docker builder' alias",
Args: cobra.ExactArgs(0),
Run: func(cmd *cobra.Command, args []string) {},
Run: func(*cobra.Command, []string) {},
Hidden: true,
}
buildxStopCmd = &cobra.Command{
Use: "stop [NAME]",
Short: "Stop builder instance",
Run: func(cmd *cobra.Command, args []string) {},
Run: func(*cobra.Command, []string) {},
}

buildxPFlags := buildxCmd.PersistentFlags()
Expand Down Expand Up @@ -255,7 +255,7 @@ func TestGenAllTree(t *testing.T) {

seen := make(map[string]struct{})

filepath.Walk("fixtures", func(path string, info fs.FileInfo, err error) error {
_ = filepath.Walk("fixtures", func(path string, info fs.FileInfo, err error) error {
fname := filepath.Base(path)
// ignore dirs and .pre.md files
if info.IsDir() || strings.HasSuffix(fname, ".pre.md") {
Expand All @@ -275,7 +275,7 @@ func TestGenAllTree(t *testing.T) {
return nil
})

filepath.Walk(tmpdir, func(path string, info fs.FileInfo, err error) error {
_ = filepath.Walk(tmpdir, func(path string, info fs.FileInfo, _ error) error {
fname := filepath.Base(path)
// ignore dirs and .pre.md files
if info.IsDir() || strings.HasSuffix(fname, ".pre.md") {
Expand Down
2 changes: 1 addition & 1 deletion clidocstool_yaml.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ type cmdDoc struct {
// subcmds, `sub` and `sub-third`, and `sub` has a subcommand called `third`
// it is undefined which help output will be in the file `cmd-sub-third.1`.
func (c *Client) GenYamlTree(cmd *cobra.Command) error {
emptyStr := func(s string) string { return "" }
emptyStr := func(string) string { return "" }
if err := c.loadLongDescription(cmd, "yaml"); err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions clidocstool_yaml_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func TestGenYamlTree(t *testing.T) {

seen := make(map[string]struct{})

filepath.Walk("fixtures", func(path string, info fs.FileInfo, err error) error {
_ = filepath.Walk("fixtures", func(path string, info fs.FileInfo, _ error) error {
fname := filepath.Base(path)
// ignore dirs and any file that is not a .yaml file
if info.IsDir() || !strings.HasSuffix(fname, ".yaml") {
Expand All @@ -60,7 +60,7 @@ func TestGenYamlTree(t *testing.T) {
return nil
})

filepath.Walk(tmpdir, func(path string, info fs.FileInfo, err error) error {
_ = filepath.Walk(tmpdir, func(path string, info fs.FileInfo, _ error) error {
fname := filepath.Base(path)
// ignore dirs and any file that is not a .yaml file
if info.IsDir() || !strings.HasSuffix(fname, ".yaml") {
Expand Down
Loading