From afd04ecf3487d214d068378b44313180aef10e28 Mon Sep 17 00:00:00 2001 From: Hosh Sadiq Date: Fri, 3 Jan 2025 22:44:56 +0000 Subject: [PATCH] Upgrade to go 1.22 + ugprade dependencies and fix manpages --- .pre-commit-config.yaml | 22 ++++---- doc/cmd_test.go | 1 + doc/man_docs.go | 103 +++++++++++++++++++++++++++++--------- doc/man_docs_test.go | 39 ++++++++++----- go.mod | 18 +++++-- go.sum | 65 ++++-------------------- internal/enumer/enumer.go | 4 +- 7 files changed, 144 insertions(+), 108 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index feea2f5..284ad18 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,39 +2,39 @@ minimum_pre_commit_version: '2.9.3' repos: - repo: https://github.com/pre-commit/pre-commit - rev: v2.17.0 + rev: v4.0.1 hooks: - id: validate_manifest - repo: https://github.com/golangci/golangci-lint - rev: v1.51.2 + rev: v1.63.3 hooks: - id: golangci-lint - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.1.0 + rev: v5.0.0 hooks: - id: check-merge-conflict - stages: [commit] + stages: [pre-commit] - id: check-symlinks - stages: [commit] + stages: [pre-commit] - id: check-yaml - stages: [commit] + stages: [pre-commit] - id: end-of-file-fixer - stages: [commit] + stages: [pre-commit] - id: trailing-whitespace - stages: [commit] + stages: [pre-commit] - id: check-toml - stages: [commit] + stages: [pre-commit] - id: mixed-line-ending - stages: [commit] + stages: [pre-commit] args: [ --fix=no ] - repo: https://github.com/markdownlint/markdownlint rev: v0.12.0 hooks: - id: markdownlint_docker - stages: [commit] + stages: [pre-commit] - repo: local hooks: diff --git a/doc/cmd_test.go b/doc/cmd_test.go index 4547c8e..d4d147b 100644 --- a/doc/cmd_test.go +++ b/doc/cmd_test.go @@ -105,6 +105,7 @@ func assertContainsf(t *testing.T, str, expected string, msg string, fmt ...inte } func assertMatch(t *testing.T, str, pattern string) { + t.Helper() if ok, _ := regexp.MatchString(pattern, str); !ok { t.Errorf("Expected to match: \n%v\nGot:\n %v\n", pattern, str) } diff --git a/doc/man_docs.go b/doc/man_docs.go index 70805dd..1ee90ed 100644 --- a/doc/man_docs.go +++ b/doc/man_docs.go @@ -161,13 +161,13 @@ func manPreamble(buf io.StringWriter, header *GenManHeader, cmd *zulu.Command, d util.WriteStringAndCheck(buf, fmt.Sprintf("%s \\- %s\n\n", dashedName, cmd.Short)) util.WriteStringAndCheck(buf, "# SYNOPSIS\n") util.WriteStringAndCheck(buf, fmt.Sprintf("**%s**\n\n", cmd.UseLine())) - util.WriteStringAndCheck(buf, "# DESCRIPTION\n") + util.WriteStringAndCheck(buf, "# DESCRIPTION\n\n") util.WriteStringAndCheck(buf, description+"\n\n") } func manPrintCommands(buf io.StringWriter, header *GenManHeader, cmd *zulu.Command) { // Find sub-commands that need to be documented - subCommands := []*zulu.Command{} + var subCommands []*zulu.Command for _, c := range cmd.Commands() { if !c.IsAvailableCommand() || c.IsAdditionalHelpTopicCommand() { continue @@ -186,7 +186,11 @@ func manPrintCommands(buf io.StringWriter, header *GenManHeader, cmd *zulu.Comma // man page for _, c := range subCommands { dashedPath := strings.ReplaceAll(c.CommandPath(), " ", "-") - util.WriteStringAndCheck(buf, fmt.Sprintf("**%s**\n\t%s \n\tSee **%s(%s)**.\n\n", c.Name(), c.Short, dashedPath, header.Section)) + var short = "" + if len(c.Short) > 0 { + short = fmt.Sprintf(" %s\n", c.Short) + } + util.WriteStringAndCheck(buf, fmt.Sprintf("**%s**\n\n%s See **%s(%s)**.\n\n", c.Name(), short, dashedPath, header.Section)) } } @@ -196,25 +200,78 @@ func manPrintFlags(buf io.StringWriter, flags *zflag.FlagSet) { return } format := "" - if flag.Shorthand > 0 && len(flag.ShorthandDeprecated) == 0 { - format = fmt.Sprintf("**-%c**, **--%s**", flag.Shorthand, flag.Name) - } else { - format = fmt.Sprintf("**--%s**", flag.Name) + + varname, usage := zflag.UnquoteUsage(flag) + + varname = strings.ReplaceAll(varname, "<", "\\<") + varname = strings.ReplaceAll(varname, ">", "\\>") + + _, isOptional := flag.Value.(zflag.OptionalValue) + _, isBoolean := flag.Value.(zflag.BoolFlag) + + var args []any + hasShorthand := flag.Shorthand > 0 && len(flag.ShorthandDeprecated) == 0 + if hasShorthand { + format += "**-%c**" + args = append(args, flag.Shorthand) + + if varname != "" { + format += " " + if isOptional { + format += "[" + } + format += "%s" + args = append(args, varname) + if isOptional { + format += "]" + } + } + + if !flag.ShorthandOnly { + format += ", " + } } - if _, isOptional := flag.Value.(zflag.OptionalValue); isOptional { - format += "[" + + if !hasShorthand || !flag.ShorthandOnly { + if isBoolean { + if flag.AddNegative { + format += ", **--[no-]%s**" + } else { + format += "**--%s**" + } + args = append(args, flag.Name) + } else { + format += "**--%s**" + args = append(args, flag.Name) + + if isOptional { + format += "[" + } + + format += " %s" + args = append(args, varname) + if isOptional { + format += "]" + } + } } - if v, ok := flag.Value.(zflag.Typed); ok && v.Type() == "string" { - // put quotes on the value - format += "=%q" - } else { - format += "=%s" + + format += "\n\n" + + if usage != "" { + format += "\t%s\n" + args = append(args, usage) } - if _, isOptional := flag.Value.(zflag.OptionalValue); isOptional { - format += "]" + + if flag.DefValue != "" && !isBoolean { + format += "\tDefaults to: %s\n" + args = append(args, flag.DefValue) } - format += "\n\t%s\n\n" - util.WriteStringAndCheck(buf, fmt.Sprintf(format, flag.DefValue, flag.Usage)) + if usage != "" || (flag.DefValue != "" && !isBoolean) { + format += "\n" + } + + util.WriteStringAndCheck(buf, fmt.Sprintf(format, args...)) }) } @@ -252,12 +309,11 @@ func genMan(cmd *zulu.Command, header *GenManHeader) []byte { } if hasSeeAlso(cmd) { buf.WriteString("# SEE ALSO\n") - seealsos := make([]string, 0) + allRelated := make([]string, 0) if cmd.HasParent() { parentPath := cmd.Parent().CommandPath() dashParentPath := strings.ReplaceAll(parentPath, " ", "-") - seealso := fmt.Sprintf("**%s(%s)**", dashParentPath, header.Section) - seealsos = append(seealsos, seealso) + allRelated = append(allRelated, fmt.Sprintf("**%s(%s)**", dashParentPath, header.Section)) cmd.VisitParents(func(c *zulu.Command) { if c.DisableAutoGenTag { cmd.DisableAutoGenTag = c.DisableAutoGenTag @@ -270,10 +326,9 @@ func genMan(cmd *zulu.Command, header *GenManHeader) []byte { if !c.IsAvailableCommand() || c.IsAdditionalHelpTopicCommand() { continue } - seealso := fmt.Sprintf("**%s-%s(%s)**", dashCommandName, c.Name(), header.Section) - seealsos = append(seealsos, seealso) + allRelated = append(allRelated, fmt.Sprintf("**%s-%s(%s)**", dashCommandName, c.Name(), header.Section)) } - buf.WriteString(strings.Join(seealsos, ", ") + "\n") + buf.WriteString(strings.Join(allRelated, ", ") + "\n\n") } if !cmd.DisableAutoGenTag { buf.WriteString(fmt.Sprintf("# HISTORY\n%s Auto generated by zulucmd/zulu\n", header.Date.Format("2-Jan-2006"))) diff --git a/doc/man_docs_test.go b/doc/man_docs_test.go index afa14b5..5ce9801 100644 --- a/doc/man_docs_test.go +++ b/doc/man_docs_test.go @@ -134,12 +134,15 @@ func TestGenManNoGenTagWithDisabledParent(t *testing.T) { } func TestGenManSeeAlso(t *testing.T) { - rootCmd := &zulu.Command{Use: "root", RunE: emptyRun} - aCmd := &zulu.Command{Use: "aaa", RunE: emptyRun, Hidden: true} // #229 - bCmd := &zulu.Command{Use: "bbb", RunE: emptyRun} - cCmd := &zulu.Command{Use: "ccc", RunE: emptyRun} + rootCmd := &zulu.Command{Use: "git", Short: "the stupid content tracker", Long: "Git is a fast, scalable, distributed revision control system with an unusually rich command set that provides both high-level operations and full access to internals.", RunE: emptyRun} + aCmd := &zulu.Command{Use: "clone", RunE: emptyRun, Hidden: true} // #229 + bCmd := &zulu.Command{Use: "checkout", RunE: emptyRun} + cCmd := &zulu.Command{Use: "branch", RunE: emptyRun} rootCmd.AddCommand(aCmd, bCmd, cCmd) + // todo add the flags in the SYNOPSIS section. Instead of just writing "git [flags]", it should write "git [-C ]" + rootCmd.Flags().String("chdir", "", "Run as if git was started in instead of the current working directory.", zflag.OptShorthand('C'), zflag.OptShorthandOnly(), zflag.OptUsageType("")) + buf := new(bytes.Buffer) header := &doc.GenManHeader{} if err := doc.GenMan(rootCmd, header, buf); err != nil { @@ -150,10 +153,7 @@ func TestGenManSeeAlso(t *testing.T) { if err := assertLineFound(scanner, ".SH SEE ALSO"); err != nil { t.Fatalf("Couldn't find SEE ALSO section header: %v", err) } - if err := assertNextLineEquals(scanner, ".PP"); err != nil { - t.Fatalf("First line after SEE ALSO wasn't break-indent: %v", err) - } - if err := assertNextLineEquals(scanner, `\fBroot-bbb(1)\fP, \fBroot-ccc(1)\fP, \fBroot-completion(1)\fP`); err != nil { + if err := assertNextLineEquals(scanner, `\fBgit-branch(1)\fP, \fBgit-checkout(1)\fP, \fBgit-completion(1)\fP`); err != nil { t.Fatalf("Second line after SEE ALSO wasn't correct: %v", err) } } @@ -166,7 +166,7 @@ func TestManPrintFlagsHidesShortDeprecated(t *testing.T) { doc.ManPrintFlags(buf, c.Flags()) got := buf.String() - expected := "**--foo**=\"default\"\n\tFoo flag\n\n" + expected := "**--foo** string\n\n\tFoo flag\n\tDefaults to: default\n\n" if got != expected { t.Errorf("Expected %v, got %v", expected, got) } @@ -186,7 +186,12 @@ func TestGenManCommands(t *testing.T) { output := buf.String() assertContains(t, output, ".SH COMMANDS") - assertMatch(t, output, "\\\\fBecho\\\\fP\n[ \t]+Echo anything to the screen\n[ \t]+See \\\\fBroot\\-echo\\(2\\)\\\\fP\\\\&\\.") + assertMatch(t, output, `\\fBecho\\fP + +\.EX +Echo anything to the screen +See \*\*root\-echo\(2\)\*\*\. +\.EE`) assertNotContains(t, output, ".PP\n\\fBprint\\fP\n") // Echo command @@ -197,8 +202,18 @@ func TestGenManCommands(t *testing.T) { output = buf.String() assertContains(t, output, ".SH COMMANDS") - assertMatch(t, output, "\\\\fBtimes\\\\fP\n[ \t]+Echo anything to the screen more times\n[ \t]+See \\\\fBroot\\-echo\\-times\\(2\\)\\\\fP\\\\&\\.") - assertMatch(t, output, "\\\\fBechosub\\\\fP\n[ \t]+second sub command for echo\n[ \t]+See \\\\fBroot\\-echo\\-echosub\\(2\\)\\\\fP\\\\&\\.") + assertMatch(t, output, `\\fBtimes\\fP + +\.EX +Echo anything to the screen more times +See \*\*root\-echo\-times\(2\)\*\*\. +\.EE`) + assertMatch(t, output, `\\fBechosub\\fP + +\.EX +second sub command for echo +See \*\*root\-echo\-echosub\(2\)\*\*\. +\.EE`) assertNotContains(t, output, ".PP\n\\fBdeprecated\\fP\n") // Time command as echo's subcommand diff --git a/go.mod b/go.mod index f0a2394..9a8ef0c 100644 --- a/go.mod +++ b/go.mod @@ -1,13 +1,21 @@ module github.com/zulucmd/zulu/v2 -go 1.16 +go 1.22.0 + +toolchain go1.23.4 require ( - github.com/cpuguy83/go-md2man/v2 v2.0.3 + github.com/cpuguy83/go-md2man/v2 v2.0.6 github.com/inconshreveable/mousetrap v1.1.0 - github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect github.com/zulucmd/zflag/v2 v2.0.0 - golang.org/x/tools v0.14.0 - gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect + golang.org/x/tools v0.28.0 gopkg.in/yaml.v3 v3.0.1 ) + +require ( + github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect + github.com/russross/blackfriday/v2 v2.1.0 // indirect + golang.org/x/mod v0.22.0 // indirect + golang.org/x/sync v0.10.0 // indirect + gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect +) diff --git a/go.sum b/go.sum index 94df68b..569707e 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,7 @@ -github.com/cpuguy83/go-md2man/v2 v2.0.3 h1:qMCsGGgs+MAzDFyp9LpAe1Lqy/fY/qCovCm0qnXZOBM= -github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/cpuguy83/go-md2man/v2 v2.0.6 h1:XJtiaUW6dEEqVuZiMTn1ldk455QWwEIsMIJlo5vtkx0= +github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/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/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= @@ -9,61 +11,14 @@ github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWb github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/zulucmd/zflag/v2 v2.0.0 h1:9m+sfIL9OgeRhGyowH64qeUH34oe/V52q/LcHxiMBuc= github.com/zulucmd/zflag/v2 v2.0.0/go.mod h1:DIIanJodikANXLSXUxXUljJSxGKD4PIEV0GZxBVZTlU= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= -golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= -golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.13.0 h1:I/DsJXRlw/8l/0c24sM9yb0T4z9liZTduXvdAWYiysY= -golang.org/x/mod v0.13.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= -golang.org/x/net v0.16.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= -golang.org/x/sync v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ= -golang.org/x/sync v0.4.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-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -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.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= -golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU= -golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= -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.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.13.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.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= -golang.org/x/tools v0.14.0 h1:jvNa2pY0M4r62jkRQ6RwEZZyPcymeL9XZMLBbV7U2nc= -golang.org/x/tools v0.14.0/go.mod h1:uYBEerGOWcJyEORxN+Ek8+TT266gXkNlHdJBwexUsBg= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4= +golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= +golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= +golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/tools v0.28.0 h1:WuB6qZ4RPCQo5aP3WdKZS7i595EdWqWR8vqJTlwTVK8= +golang.org/x/tools v0.28.0/go.mod h1:dcIOrVd3mfQKTgrDVQHqCPMWy6lnhfhtX3hLXYVLfRw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/internal/enumer/enumer.go b/internal/enumer/enumer.go index fcada9a..65e9033 100644 --- a/internal/enumer/enumer.go +++ b/internal/enumer/enumer.go @@ -169,7 +169,9 @@ type Package struct { // parsePackage exits if there is an error. func (g *Generator) parsePackage(patterns []string) { cfg := &packages.Config{ - Mode: packages.NeedName | packages.NeedFiles | packages.NeedCompiledGoFiles | packages.NeedImports | packages.NeedTypes | packages.NeedTypesSizes | packages.NeedSyntax | packages.NeedTypesInfo, + Mode: packages.NeedName | packages.NeedFiles | packages.NeedCompiledGoFiles | + packages.NeedImports | packages.NeedTypes | packages.NeedTypesSizes | + packages.NeedSyntax | packages.NeedTypesInfo, Tests: false, } pkgs, err := packages.Load(cfg, patterns...)