~shulhan/ciigo

f9b75247b24c1e4a33449065ee35aef50ccfa115 — Shulhan 5 months ago 949be83
cmd/ciigo: instantiate variable on switch cases

Instead of creating variables on top of switch, only declare them when
needed.
1 files changed, 9 insertions(+), 7 deletions(-)

M cmd/ciigo/main.go
M cmd/ciigo/main.go => cmd/ciigo/main.go +9 -7
@@ 73,10 73,7 @@ func main() {
			HTMLTemplate: *htmlTemplate,
			Exclude:      *exclude,
		}

		embedOpts ciigo.EmbedOptions
		serveOpts ciigo.ServeOptions
		err       error
		err error
	)

	if len(command) == 0 {


@@ 92,6 89,8 @@ func main() {
		err = ciigo.Convert(&convertOpts)

	case cmdEmbed:
		var embedOpts ciigo.EmbedOptions

		embedOpts.ConvertOptions = convertOpts
		embedOpts.EmbedOptions.GoFileName = *outputFile



@@ 101,9 100,12 @@ func main() {
		usage()

	case cmdServe:
		serveOpts.ConvertOptions = convertOpts
		serveOpts.Address = *address
		serveOpts.IsDevelopment = true
		var serveOpts = ciigo.ServeOptions{
			ConvertOptions:  convertOpts,
			Address:         *address,
			EnableIndexHTML: true,
			IsDevelopment:   true,
		}
		err = ciigo.Serve(&serveOpts)

	case cmdVersion: