Skip to content
This repository has been archived by the owner on Jul 12, 2022. It is now read-only.

Bug with existing config.json variable name with upgrade to 2.3.0 #665

Closed
GuillaumeFalourd opened this issue Nov 11, 2020 · 1 comment · Fixed by #693
Closed

Bug with existing config.json variable name with upgrade to 2.3.0 #665

GuillaumeFalourd opened this issue Nov 11, 2020 · 1 comment · Fixed by #693
Assignees
Labels
🪲 bug Report a bug encountered while operating Ritchie
Milestone

Comments

@GuillaumeFalourd
Copy link
Contributor

GuillaumeFalourd commented Nov 11, 2020

What happened

With the last upgrade to version 2.3.0, the following error occurred:

panic: tools flag redefined: tool

goroutine 1 [running]:
github.com/spf13/pflag.(*FlagSet).AddFlag(0xc0003bed00, 0xc0003afe00)
	/workspace/vendor/github.com/spf13/pflag/flag.go:848 +0x807
github.com/spf13/pflag.(*FlagSet).VarPF(0xc0003bed00, 0x1cfce80, 0xc0003c4470, 0xc0003c040c, 0x4, 0x0, 0x0, 0xc0003313c0, 0x3e, 0xc0003c4470)
	/workspace/vendor/github.com/spf13/pflag/flag.go:831 +0x10b
github.com/spf13/pflag.(*FlagSet).VarP(...)
	/workspace/vendor/github.com/spf13/pflag/flag.go:837
github.com/spf13/pflag.(*FlagSet).StringVarP(0xc0003bed00, 0xc0003c4470, 0xc0003c040c, 0x4, 0x0, 0x0, 0x0, 0x0, 0xc0003313c0, 0x3e)
	/workspace/vendor/github.com/spf13/pflag/string.go:42 +0xad
github.com/spf13/pflag.(*FlagSet).String(...)
	/workspace/vendor/github.com/spf13/pflag/string.go:60
github.com/ZupIT/ritchie-cli/pkg/cmd.FormulaCommand.addInputFlags(0x2401040, 0x23, 0x23, 0x1cf1340, 0xc000218120, 0x1ce8040, 0xc000203bc0, 0x1ce83a0, 0x2435700, 0xc0003c0340, ...)
	/workspace/pkg/cmd/formula.go:246 +0x4bd
github.com/ZupIT/ritchie-cli/pkg/cmd.FormulaCommand.newFormulaCmd(0x2401040, 0x23, 0x23, 0x1cf1340, 0xc000218120, 0x1ce8040, 0xc000203bc0, 0x1ce83a0, 0x2435700, 0xc000261220, ...)
	/workspace/pkg/cmd/formula.go:161 +0x249
github.com/ZupIT/ritchie-cli/pkg/cmd.FormulaCommand.Add(0x2401040, 0x23, 0x23, 0x1cf1340, 0xc000218120, 0x1ce8040, 0xc000203bc0, 0x1ce83a0, 0x2435700, 0xc000155080, ...)
	/workspace/pkg/cmd/formula.go:115 +0x358
github.com/ZupIT/ritchie-cli/pkg/commands.Build(0xbfe31bb0c21a7b90)
	/workspace/pkg/commands/builder.go:242 +0x5606
main.main()
	/workspace/cmd/main.go:30 +0x56

This was due to the fact that I add in my .rit/repos/ folder a repository with a fórmula having a variable name tool configured on its config.json file. Some variable names are now 'protected' to avoid problem with local variables.

Removing the related formula from the .rit/repos/ folder resolved the problem, but I wasn't able to use Ritchie CLI at all due to this error.

It would be interesting to warn the user with a friendly message when this occur, to let him know what has to be done to resolve the problem.

@GuillaumeFalourd GuillaumeFalourd added the 🪲 bug Report a bug encountered while operating Ritchie label Nov 11, 2020
@henriquemoraeszup henriquemoraeszup added this to the 2.5.0 milestone Nov 16, 2020
@GuillaumeFalourd
Copy link
Contributor Author

GuillaumeFalourd commented Nov 18, 2020

It seems the problem occurs even after renaming the variable (from tool to rit_tool)

panic: tools flag redefined: rit_tool

goroutine 1 [running]:
github.com/spf13/pflag.(*FlagSet).AddFlag(0xc000449a00, 0xc00044d4a0)
	/workspace/vendor/github.com/spf13/pflag/flag.go:848 +0x807
github.com/spf13/pflag.(*FlagSet).VarPF(0xc000449a00, 0x1cfdea0, 0xc000455580, 0xc00044ade0, 0x8, 0x0, 0x0, 0xc0003cf380, 0x3e, 0xc000455580)
	/workspace/vendor/github.com/spf13/pflag/flag.go:831 +0x10b
github.com/spf13/pflag.(*FlagSet).VarP(...)
	/workspace/vendor/github.com/spf13/pflag/flag.go:837
github.com/spf13/pflag.(*FlagSet).StringVarP(0xc000449a00, 0xc000455580, 0xc00044ade0, 0x8, 0x0, 0x0, 0x0, 0x0, 0xc0003cf380, 0x3e)
	/workspace/vendor/github.com/spf13/pflag/string.go:42 +0xad
github.com/spf13/pflag.(*FlagSet).String(...)
	/workspace/vendor/github.com/spf13/pflag/string.go:60
github.com/ZupIT/ritchie-cli/pkg/cmd.FormulaCommand.addInputFlags(0x2403080, 0x23, 0x23, 0x1cf2360, 0xc000284180, 0x1ce8fe0, 0xc000275a40, 0x1ce9340, 0x2437740, 0xc00044ad00, ...)
	/workspace/pkg/cmd/formula.go:252 +0x4bd
github.com/ZupIT/ritchie-cli/pkg/cmd.FormulaCommand.newFormulaCmd(0x2403080, 0x23, 0x23, 0x1cf2360, 0xc000284180, 0x1ce8fe0, 0xc000275a40, 0x1ce9340, 0x2437740, 0xc0002d57e0, ...)
	/workspace/pkg/cmd/formula.go:167 +0x249
github.com/ZupIT/ritchie-cli/pkg/cmd.FormulaCommand.Add(0x2403080, 0x23, 0x23, 0x1cf2360, 0xc000284180, 0x1ce8fe0, 0xc000275a40, 0x1ce9340, 0x2437740, 0xc0001c7080, ...)
	/workspace/pkg/cmd/formula.go:121 +0x358
github.com/ZupIT/ritchie-cli/pkg/commands.Build(0xbfe56214c4c1a6c0)
	/workspace/pkg/commands/builder.go:243 +0x561d
main.main()
	/workspace/cmd/main.go:30 +0x56

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🪲 bug Report a bug encountered while operating Ritchie
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants