From 00539c397a858044ca3edd31c665a1c60e5e6355 Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Fri, 31 May 2024 22:05:57 -0400 Subject: [PATCH] Fixes issue #3725 --- src/apps/chifra/internal/abis/options.go | 13 ++++++------ src/apps/chifra/internal/blocks/options.go | 13 ++++++------ src/apps/chifra/internal/chunks/options.go | 16 ++++++++------- src/apps/chifra/internal/config/options.go | 13 ++++++------ src/apps/chifra/internal/daemon/options.go | 16 ++++++++------- src/apps/chifra/internal/explore/options.go | 13 ++++++------ src/apps/chifra/internal/export/options.go | 15 +++++++------- src/apps/chifra/internal/init/options.go | 13 ++++++------ src/apps/chifra/internal/list/options.go | 15 +++++++------- src/apps/chifra/internal/logs/options.go | 13 ++++++------ src/apps/chifra/internal/monitors/options.go | 15 +++++++------- src/apps/chifra/internal/names/options.go | 13 ++++++------ src/apps/chifra/internal/receipts/options.go | 13 ++++++------ src/apps/chifra/internal/scrape/options.go | 20 ++++++++++++------- src/apps/chifra/internal/slurp/options.go | 16 ++++++++------- src/apps/chifra/internal/state/options.go | 13 ++++++------ src/apps/chifra/internal/status/options.go | 14 ++++++------- src/apps/chifra/internal/tokens/options.go | 13 ++++++------ src/apps/chifra/internal/traces/options.go | 13 ++++++------ .../chifra/internal/transactions/options.go | 13 ++++++------ src/apps/chifra/internal/when/options.go | 14 ++++++------- ...apps_chifra_internal_route_options.go.tmpl | 15 +++++++------- src/dev_tools/goMaker/types/types_command.go | 4 ++-- 23 files changed, 159 insertions(+), 157 deletions(-) diff --git a/src/apps/chifra/internal/abis/options.go b/src/apps/chifra/internal/abis/options.go index a07a786b38..d55cc6d2be 100644 --- a/src/apps/chifra/internal/abis/options.go +++ b/src/apps/chifra/internal/abis/options.go @@ -171,13 +171,12 @@ func getCaps() caps.Capability { func ResetOptions(testMode bool) { // We want to keep writer between command file calls w := GetOptions().Globals.Writer - defaultAbisOptions = AbisOptions{} - globals.SetDefaults(&defaultAbisOptions.Globals) - defaultAbisOptions.Globals.TestMode = testMode - defaultAbisOptions.Globals.Writer = w - // EXISTING_CODE - // EXISTING_CODE - defaultAbisOptions.Globals.Caps = getCaps() + opts := AbisOptions{} + globals.SetDefaults(&opts.Globals) + opts.Globals.TestMode = testMode + opts.Globals.Writer = w + opts.Globals.Caps = getCaps() + defaultAbisOptions = opts } func (opts *AbisOptions) getCaches() (m map[string]bool) { diff --git a/src/apps/chifra/internal/blocks/options.go b/src/apps/chifra/internal/blocks/options.go index acb234bbd2..324f86316b 100644 --- a/src/apps/chifra/internal/blocks/options.go +++ b/src/apps/chifra/internal/blocks/options.go @@ -199,13 +199,12 @@ func getCaps() caps.Capability { func ResetOptions(testMode bool) { // We want to keep writer between command file calls w := GetOptions().Globals.Writer - defaultBlocksOptions = BlocksOptions{} - globals.SetDefaults(&defaultBlocksOptions.Globals) - defaultBlocksOptions.Globals.TestMode = testMode - defaultBlocksOptions.Globals.Writer = w - // EXISTING_CODE - // EXISTING_CODE - defaultBlocksOptions.Globals.Caps = getCaps() + opts := BlocksOptions{} + globals.SetDefaults(&opts.Globals) + opts.Globals.TestMode = testMode + opts.Globals.Writer = w + opts.Globals.Caps = getCaps() + defaultBlocksOptions = opts } func (opts *BlocksOptions) getCaches() (m map[string]bool) { diff --git a/src/apps/chifra/internal/chunks/options.go b/src/apps/chifra/internal/chunks/options.go index 997826c97e..05f90e77c8 100644 --- a/src/apps/chifra/internal/chunks/options.go +++ b/src/apps/chifra/internal/chunks/options.go @@ -262,13 +262,15 @@ func getCaps() caps.Capability { func ResetOptions(testMode bool) { // We want to keep writer between command file calls w := GetOptions().Globals.Writer - defaultChunksOptions = ChunksOptions{} - globals.SetDefaults(&defaultChunksOptions.Globals) - defaultChunksOptions.Globals.TestMode = testMode - defaultChunksOptions.Globals.Writer = w - // EXISTING_CODE - // EXISTING_CODE - defaultChunksOptions.Globals.Caps = getCaps() + opts := ChunksOptions{} + globals.SetDefaults(&opts.Globals) + opts.Globals.TestMode = testMode + opts.Globals.Writer = w + opts.Globals.Caps = getCaps() + opts.Truncate = base.NOPOSN + opts.LastBlock = base.NOPOSN + opts.MaxAddrs = base.NOPOS + defaultChunksOptions = opts } func (opts *ChunksOptions) getCaches() (m map[string]bool) { diff --git a/src/apps/chifra/internal/config/options.go b/src/apps/chifra/internal/config/options.go index 584307f73a..6aa7dd6373 100644 --- a/src/apps/chifra/internal/config/options.go +++ b/src/apps/chifra/internal/config/options.go @@ -138,13 +138,12 @@ func getCaps() caps.Capability { func ResetOptions(testMode bool) { // We want to keep writer between command file calls w := GetOptions().Globals.Writer - defaultConfigOptions = ConfigOptions{} - globals.SetDefaults(&defaultConfigOptions.Globals) - defaultConfigOptions.Globals.TestMode = testMode - defaultConfigOptions.Globals.Writer = w - // EXISTING_CODE - // EXISTING_CODE - defaultConfigOptions.Globals.Caps = getCaps() + opts := ConfigOptions{} + globals.SetDefaults(&opts.Globals) + opts.Globals.TestMode = testMode + opts.Globals.Writer = w + opts.Globals.Caps = getCaps() + defaultConfigOptions = opts } func (opts *ConfigOptions) getCaches() (m map[string]bool) { diff --git a/src/apps/chifra/internal/daemon/options.go b/src/apps/chifra/internal/daemon/options.go index 88189f81f2..da87089c42 100644 --- a/src/apps/chifra/internal/daemon/options.go +++ b/src/apps/chifra/internal/daemon/options.go @@ -174,13 +174,15 @@ func getCaps() caps.Capability { func ResetOptions(testMode bool) { // We want to keep writer between command file calls w := GetOptions().Globals.Writer - defaultDaemonOptions = DaemonOptions{} - globals.SetDefaults(&defaultDaemonOptions.Globals) - defaultDaemonOptions.Globals.TestMode = testMode - defaultDaemonOptions.Globals.Writer = w - // EXISTING_CODE - // EXISTING_CODE - defaultDaemonOptions.Globals.Caps = getCaps() + opts := DaemonOptions{} + globals.SetDefaults(&opts.Globals) + opts.Globals.TestMode = testMode + opts.Globals.Writer = w + opts.Globals.Caps = getCaps() + opts.Url = "localhost:8080" + opts.Api = "on" + opts.Port = ":8080" + defaultDaemonOptions = opts } func (opts *DaemonOptions) getCaches() (m map[string]bool) { diff --git a/src/apps/chifra/internal/explore/options.go b/src/apps/chifra/internal/explore/options.go index cc4a5af1cf..5461784a2c 100644 --- a/src/apps/chifra/internal/explore/options.go +++ b/src/apps/chifra/internal/explore/options.go @@ -148,13 +148,12 @@ func getCaps() caps.Capability { func ResetOptions(testMode bool) { // We want to keep writer between command file calls w := GetOptions().Globals.Writer - defaultExploreOptions = ExploreOptions{} - globals.SetDefaults(&defaultExploreOptions.Globals) - defaultExploreOptions.Globals.TestMode = testMode - defaultExploreOptions.Globals.Writer = w - // EXISTING_CODE - // EXISTING_CODE - defaultExploreOptions.Globals.Caps = getCaps() + opts := ExploreOptions{} + globals.SetDefaults(&opts.Globals) + opts.Globals.TestMode = testMode + opts.Globals.Writer = w + opts.Globals.Caps = getCaps() + defaultExploreOptions = opts } func (opts *ExploreOptions) getCaches() (m map[string]bool) { diff --git a/src/apps/chifra/internal/export/options.go b/src/apps/chifra/internal/export/options.go index d9c85d71ed..62cc90bcb4 100644 --- a/src/apps/chifra/internal/export/options.go +++ b/src/apps/chifra/internal/export/options.go @@ -296,13 +296,14 @@ func getCaps() caps.Capability { func ResetOptions(testMode bool) { // We want to keep writer between command file calls w := GetOptions().Globals.Writer - defaultExportOptions = ExportOptions{} - globals.SetDefaults(&defaultExportOptions.Globals) - defaultExportOptions.Globals.TestMode = testMode - defaultExportOptions.Globals.Writer = w - // EXISTING_CODE - // EXISTING_CODE - defaultExportOptions.Globals.Caps = getCaps() + opts := ExportOptions{} + globals.SetDefaults(&opts.Globals) + opts.Globals.TestMode = testMode + opts.Globals.Writer = w + opts.Globals.Caps = getCaps() + opts.MaxRecords = 250 + opts.LastBlock = base.NOPOSN + defaultExportOptions = opts } func (opts *ExportOptions) getCaches() (m map[string]bool) { diff --git a/src/apps/chifra/internal/init/options.go b/src/apps/chifra/internal/init/options.go index 710e7a8c5c..5d3e2caf93 100644 --- a/src/apps/chifra/internal/init/options.go +++ b/src/apps/chifra/internal/init/options.go @@ -161,13 +161,12 @@ func getCaps() caps.Capability { func ResetOptions(testMode bool) { // We want to keep writer between command file calls w := GetOptions().Globals.Writer - defaultInitOptions = InitOptions{} - globals.SetDefaults(&defaultInitOptions.Globals) - defaultInitOptions.Globals.TestMode = testMode - defaultInitOptions.Globals.Writer = w - // EXISTING_CODE - // EXISTING_CODE - defaultInitOptions.Globals.Caps = getCaps() + opts := InitOptions{} + globals.SetDefaults(&opts.Globals) + opts.Globals.TestMode = testMode + opts.Globals.Writer = w + opts.Globals.Caps = getCaps() + defaultInitOptions = opts } func (opts *InitOptions) getCaches() (m map[string]bool) { diff --git a/src/apps/chifra/internal/list/options.go b/src/apps/chifra/internal/list/options.go index d4071333be..27a8e879ee 100644 --- a/src/apps/chifra/internal/list/options.go +++ b/src/apps/chifra/internal/list/options.go @@ -194,13 +194,14 @@ func getCaps() caps.Capability { func ResetOptions(testMode bool) { // We want to keep writer between command file calls w := GetOptions().Globals.Writer - defaultListOptions = ListOptions{} - globals.SetDefaults(&defaultListOptions.Globals) - defaultListOptions.Globals.TestMode = testMode - defaultListOptions.Globals.Writer = w - // EXISTING_CODE - // EXISTING_CODE - defaultListOptions.Globals.Caps = getCaps() + opts := ListOptions{} + globals.SetDefaults(&opts.Globals) + opts.Globals.TestMode = testMode + opts.Globals.Writer = w + opts.Globals.Caps = getCaps() + opts.MaxRecords = 250 + opts.LastBlock = base.NOPOSN + defaultListOptions = opts } func (opts *ListOptions) getCaches() (m map[string]bool) { diff --git a/src/apps/chifra/internal/logs/options.go b/src/apps/chifra/internal/logs/options.go index 889df7b9a9..0e58e8505a 100644 --- a/src/apps/chifra/internal/logs/options.go +++ b/src/apps/chifra/internal/logs/options.go @@ -155,13 +155,12 @@ func getCaps() caps.Capability { func ResetOptions(testMode bool) { // We want to keep writer between command file calls w := GetOptions().Globals.Writer - defaultLogsOptions = LogsOptions{} - globals.SetDefaults(&defaultLogsOptions.Globals) - defaultLogsOptions.Globals.TestMode = testMode - defaultLogsOptions.Globals.Writer = w - // EXISTING_CODE - // EXISTING_CODE - defaultLogsOptions.Globals.Caps = getCaps() + opts := LogsOptions{} + globals.SetDefaults(&opts.Globals) + opts.Globals.TestMode = testMode + opts.Globals.Writer = w + opts.Globals.Caps = getCaps() + defaultLogsOptions = opts } func (opts *LogsOptions) getCaches() (m map[string]bool) { diff --git a/src/apps/chifra/internal/monitors/options.go b/src/apps/chifra/internal/monitors/options.go index fd97881e52..27c92ef53f 100644 --- a/src/apps/chifra/internal/monitors/options.go +++ b/src/apps/chifra/internal/monitors/options.go @@ -189,13 +189,14 @@ func getCaps() caps.Capability { func ResetOptions(testMode bool) { // We want to keep writer between command file calls w := GetOptions().Globals.Writer - defaultMonitorsOptions = MonitorsOptions{} - globals.SetDefaults(&defaultMonitorsOptions.Globals) - defaultMonitorsOptions.Globals.TestMode = testMode - defaultMonitorsOptions.Globals.Writer = w - // EXISTING_CODE - // EXISTING_CODE - defaultMonitorsOptions.Globals.Caps = getCaps() + opts := MonitorsOptions{} + globals.SetDefaults(&opts.Globals) + opts.Globals.TestMode = testMode + opts.Globals.Writer = w + opts.Globals.Caps = getCaps() + opts.BatchSize = 8 + opts.Sleep = 14 + defaultMonitorsOptions = opts } func (opts *MonitorsOptions) getCaches() (m map[string]bool) { diff --git a/src/apps/chifra/internal/names/options.go b/src/apps/chifra/internal/names/options.go index 8f3b10d9a8..d5648b61ae 100644 --- a/src/apps/chifra/internal/names/options.go +++ b/src/apps/chifra/internal/names/options.go @@ -205,13 +205,12 @@ func getCaps() caps.Capability { func ResetOptions(testMode bool) { // We want to keep writer between command file calls w := GetOptions().Globals.Writer - defaultNamesOptions = NamesOptions{} - globals.SetDefaults(&defaultNamesOptions.Globals) - defaultNamesOptions.Globals.TestMode = testMode - defaultNamesOptions.Globals.Writer = w - // EXISTING_CODE - // EXISTING_CODE - defaultNamesOptions.Globals.Caps = getCaps() + opts := NamesOptions{} + globals.SetDefaults(&opts.Globals) + opts.Globals.TestMode = testMode + opts.Globals.Writer = w + opts.Globals.Caps = getCaps() + defaultNamesOptions = opts } func (opts *NamesOptions) getCaches() (m map[string]bool) { diff --git a/src/apps/chifra/internal/receipts/options.go b/src/apps/chifra/internal/receipts/options.go index 6ad5acb4f9..c64f740e9c 100644 --- a/src/apps/chifra/internal/receipts/options.go +++ b/src/apps/chifra/internal/receipts/options.go @@ -139,13 +139,12 @@ func getCaps() caps.Capability { func ResetOptions(testMode bool) { // We want to keep writer between command file calls w := GetOptions().Globals.Writer - defaultReceiptsOptions = ReceiptsOptions{} - globals.SetDefaults(&defaultReceiptsOptions.Globals) - defaultReceiptsOptions.Globals.TestMode = testMode - defaultReceiptsOptions.Globals.Writer = w - // EXISTING_CODE - // EXISTING_CODE - defaultReceiptsOptions.Globals.Caps = getCaps() + opts := ReceiptsOptions{} + globals.SetDefaults(&opts.Globals) + opts.Globals.TestMode = testMode + opts.Globals.Writer = w + opts.Globals.Caps = getCaps() + defaultReceiptsOptions = opts } func (opts *ReceiptsOptions) getCaches() (m map[string]bool) { diff --git a/src/apps/chifra/internal/scrape/options.go b/src/apps/chifra/internal/scrape/options.go index 0ae84f7e85..78f5f441d6 100644 --- a/src/apps/chifra/internal/scrape/options.go +++ b/src/apps/chifra/internal/scrape/options.go @@ -192,13 +192,19 @@ func getCaps() caps.Capability { func ResetOptions(testMode bool) { // We want to keep writer between command file calls w := GetOptions().Globals.Writer - defaultScrapeOptions = ScrapeOptions{} - globals.SetDefaults(&defaultScrapeOptions.Globals) - defaultScrapeOptions.Globals.TestMode = testMode - defaultScrapeOptions.Globals.Writer = w - // EXISTING_CODE - // EXISTING_CODE - defaultScrapeOptions.Globals.Caps = getCaps() + opts := ScrapeOptions{} + globals.SetDefaults(&opts.Globals) + opts.Globals.TestMode = testMode + opts.Globals.Writer = w + opts.Globals.Caps = getCaps() + opts.BlockCnt = 2000 + opts.Sleep = 14 + opts.Settings.AppsPerChunk = 2000000 + opts.Settings.SnapToGrid = 250000 + opts.Settings.FirstSnap = 2000000 + opts.Settings.UnripeDist = 28 + opts.Settings.ChannelCount = 20 + defaultScrapeOptions = opts } func (opts *ScrapeOptions) getCaches() (m map[string]bool) { diff --git a/src/apps/chifra/internal/slurp/options.go b/src/apps/chifra/internal/slurp/options.go index 7913c47b71..86161eab0b 100644 --- a/src/apps/chifra/internal/slurp/options.go +++ b/src/apps/chifra/internal/slurp/options.go @@ -237,13 +237,15 @@ func getCaps() caps.Capability { func ResetOptions(testMode bool) { // We want to keep writer between command file calls w := GetOptions().Globals.Writer - defaultSlurpOptions = SlurpOptions{} - globals.SetDefaults(&defaultSlurpOptions.Globals) - defaultSlurpOptions.Globals.TestMode = testMode - defaultSlurpOptions.Globals.Writer = w - // EXISTING_CODE - // EXISTING_CODE - defaultSlurpOptions.Globals.Caps = getCaps() + opts := SlurpOptions{} + globals.SetDefaults(&opts.Globals) + opts.Globals.TestMode = testMode + opts.Globals.Writer = w + opts.Globals.Caps = getCaps() + opts.Source = "etherscan" + opts.PerPage = 1000 + opts.Sleep = .25 + defaultSlurpOptions = opts } func (opts *SlurpOptions) getCaches() (m map[string]bool) { diff --git a/src/apps/chifra/internal/state/options.go b/src/apps/chifra/internal/state/options.go index 8a1d9a129c..9c34012799 100644 --- a/src/apps/chifra/internal/state/options.go +++ b/src/apps/chifra/internal/state/options.go @@ -200,13 +200,12 @@ func getCaps() caps.Capability { func ResetOptions(testMode bool) { // We want to keep writer between command file calls w := GetOptions().Globals.Writer - defaultStateOptions = StateOptions{} - globals.SetDefaults(&defaultStateOptions.Globals) - defaultStateOptions.Globals.TestMode = testMode - defaultStateOptions.Globals.Writer = w - // EXISTING_CODE - // EXISTING_CODE - defaultStateOptions.Globals.Caps = getCaps() + opts := StateOptions{} + globals.SetDefaults(&opts.Globals) + opts.Globals.TestMode = testMode + opts.Globals.Writer = w + opts.Globals.Caps = getCaps() + defaultStateOptions = opts } func (opts *StateOptions) getCaches() (m map[string]bool) { diff --git a/src/apps/chifra/internal/status/options.go b/src/apps/chifra/internal/status/options.go index e7f2fd09f2..331433ae89 100644 --- a/src/apps/chifra/internal/status/options.go +++ b/src/apps/chifra/internal/status/options.go @@ -165,13 +165,13 @@ func getCaps() caps.Capability { func ResetOptions(testMode bool) { // We want to keep writer between command file calls w := GetOptions().Globals.Writer - defaultStatusOptions = StatusOptions{} - globals.SetDefaults(&defaultStatusOptions.Globals) - defaultStatusOptions.Globals.TestMode = testMode - defaultStatusOptions.Globals.Writer = w - // EXISTING_CODE - // EXISTING_CODE - defaultStatusOptions.Globals.Caps = getCaps() + opts := StatusOptions{} + globals.SetDefaults(&opts.Globals) + opts.Globals.TestMode = testMode + opts.Globals.Writer = w + opts.Globals.Caps = getCaps() + opts.MaxRecords = 10000 + defaultStatusOptions = opts } func (opts *StatusOptions) getCaches() (m map[string]bool) { diff --git a/src/apps/chifra/internal/tokens/options.go b/src/apps/chifra/internal/tokens/options.go index cf72f3d29e..3ea43bc1f4 100644 --- a/src/apps/chifra/internal/tokens/options.go +++ b/src/apps/chifra/internal/tokens/options.go @@ -201,13 +201,12 @@ func getCaps() caps.Capability { func ResetOptions(testMode bool) { // We want to keep writer between command file calls w := GetOptions().Globals.Writer - defaultTokensOptions = TokensOptions{} - globals.SetDefaults(&defaultTokensOptions.Globals) - defaultTokensOptions.Globals.TestMode = testMode - defaultTokensOptions.Globals.Writer = w - // EXISTING_CODE - // EXISTING_CODE - defaultTokensOptions.Globals.Caps = getCaps() + opts := TokensOptions{} + globals.SetDefaults(&opts.Globals) + opts.Globals.TestMode = testMode + opts.Globals.Writer = w + opts.Globals.Caps = getCaps() + defaultTokensOptions = opts } func (opts *TokensOptions) getCaches() (m map[string]bool) { diff --git a/src/apps/chifra/internal/traces/options.go b/src/apps/chifra/internal/traces/options.go index 737692ec89..57ed049593 100644 --- a/src/apps/chifra/internal/traces/options.go +++ b/src/apps/chifra/internal/traces/options.go @@ -148,13 +148,12 @@ func getCaps() caps.Capability { func ResetOptions(testMode bool) { // We want to keep writer between command file calls w := GetOptions().Globals.Writer - defaultTracesOptions = TracesOptions{} - globals.SetDefaults(&defaultTracesOptions.Globals) - defaultTracesOptions.Globals.TestMode = testMode - defaultTracesOptions.Globals.Writer = w - // EXISTING_CODE - // EXISTING_CODE - defaultTracesOptions.Globals.Caps = getCaps() + opts := TracesOptions{} + globals.SetDefaults(&opts.Globals) + opts.Globals.TestMode = testMode + opts.Globals.Writer = w + opts.Globals.Caps = getCaps() + defaultTracesOptions = opts } func (opts *TracesOptions) getCaches() (m map[string]bool) { diff --git a/src/apps/chifra/internal/transactions/options.go b/src/apps/chifra/internal/transactions/options.go index 158a3a4528..d1095036ce 100644 --- a/src/apps/chifra/internal/transactions/options.go +++ b/src/apps/chifra/internal/transactions/options.go @@ -178,13 +178,12 @@ func getCaps() caps.Capability { func ResetOptions(testMode bool) { // We want to keep writer between command file calls w := GetOptions().Globals.Writer - defaultTransactionsOptions = TransactionsOptions{} - globals.SetDefaults(&defaultTransactionsOptions.Globals) - defaultTransactionsOptions.Globals.TestMode = testMode - defaultTransactionsOptions.Globals.Writer = w - // EXISTING_CODE - // EXISTING_CODE - defaultTransactionsOptions.Globals.Caps = getCaps() + opts := TransactionsOptions{} + globals.SetDefaults(&opts.Globals) + opts.Globals.TestMode = testMode + opts.Globals.Writer = w + opts.Globals.Caps = getCaps() + defaultTransactionsOptions = opts } func (opts *TransactionsOptions) getCaches() (m map[string]bool) { diff --git a/src/apps/chifra/internal/when/options.go b/src/apps/chifra/internal/when/options.go index b23e914799..89259ddf3d 100644 --- a/src/apps/chifra/internal/when/options.go +++ b/src/apps/chifra/internal/when/options.go @@ -174,13 +174,13 @@ func getCaps() caps.Capability { func ResetOptions(testMode bool) { // We want to keep writer between command file calls w := GetOptions().Globals.Writer - defaultWhenOptions = WhenOptions{} - globals.SetDefaults(&defaultWhenOptions.Globals) - defaultWhenOptions.Globals.TestMode = testMode - defaultWhenOptions.Globals.Writer = w - // EXISTING_CODE - // EXISTING_CODE - defaultWhenOptions.Globals.Caps = getCaps() + opts := WhenOptions{} + globals.SetDefaults(&opts.Globals) + opts.Globals.TestMode = testMode + opts.Globals.Writer = w + opts.Globals.Caps = getCaps() + opts.Truncate = base.NOPOSN + defaultWhenOptions = opts } func (opts *WhenOptions) getCaches() (m map[string]bool) { diff --git a/src/dev_tools/goMaker/templates/src_apps_chifra_internal_route_options.go.tmpl b/src/dev_tools/goMaker/templates/src_apps_chifra_internal_route_options.go.tmpl index 3d43aa796b..7b779b01aa 100644 --- a/src/dev_tools/goMaker/templates/src_apps_chifra_internal_route_options.go.tmpl +++ b/src/dev_tools/goMaker/templates/src_apps_chifra_internal_route_options.go.tmpl @@ -48,7 +48,7 @@ func {{toProper .Route}}FinishParseInternal(w io.Writer, values url.Values) *{{t copy := default{{toProper .Route}}Options copy.Globals.Caps = getCaps() opts := © -{{.DefaultsApi}} for key, value := range values { +{{.DefaultsApi true}} for key, value := range values { switch key { {{.RequestOpts}} default: if !copy.Globals.Caps.HasKey(key) { @@ -110,13 +110,12 @@ func getCaps() caps.Capability { func ResetOptions(testMode bool) { // We want to keep writer between command file calls w := GetOptions().Globals.Writer - default{{toProper .Route}}Options = {{toProper .Route}}Options{} - globals.SetDefaults(&default{{toProper .Route}}Options.Globals) - default{{toProper .Route}}Options.Globals.TestMode = testMode - default{{toProper .Route}}Options.Globals.Writer = w - // EXISTING_CODE - // EXISTING_CODE - default{{toProper .Route}}Options.Globals.Caps = getCaps() + opts := {{toProper .Route}}Options{} + globals.SetDefaults(&opts.Globals) + opts.Globals.TestMode = testMode + opts.Globals.Writer = w + opts.Globals.Caps = getCaps() +{{.DefaultsApi false}} default{{toProper .Route}}Options = opts } func (opts *{{toProper .Route}}Options) getCaches() (m map[string]bool) { diff --git a/src/dev_tools/goMaker/types/types_command.go b/src/dev_tools/goMaker/types/types_command.go index d89b9a3a62..2b1f788e2c 100644 --- a/src/dev_tools/goMaker/types/types_command.go +++ b/src/dev_tools/goMaker/types/types_command.go @@ -328,7 +328,7 @@ func (c *Command) AddCaps() string { } // DefaultsApi for tag {{.DefaultsApi}} -func (c *Command) DefaultsApi() string { +func (c *Command) DefaultsApi(showConfig bool) string { ret := []string{} hasConfig := false for _, op := range c.Options { @@ -338,7 +338,7 @@ func (c *Command) DefaultsApi() string { ret = append(ret, v) } } - if hasConfig { + if hasConfig && showConfig { ret = append(ret, " configs := make(map[string]string, 10)") } if len(ret) == 0 {