diff --git a/v3/pkg/application/options_application.go b/v3/pkg/application/options_application.go index bb07c39a5..5970caaab 100644 --- a/v3/pkg/application/options_application.go +++ b/v3/pkg/application/options_application.go @@ -20,19 +20,6 @@ type Options struct { // PanicHandler is a way to register a custom panic handler PanicHandler func(any) - - // ProductionOverrides allows you to have different options in production builds - // We would love if we could merge the options, but we can't because of the way - // Go handles zero values. - ProductionOverrides *Options -} - -func (o Options) getOptions(debugMode bool) Options { - if o.ProductionOverrides == nil || debugMode { - o.ProductionOverrides = nil - return o - } - return *o.ProductionOverrides } // AssetOptions defines the configuration of the AssetServer. diff --git a/v3/pkg/application/options_application_test.go b/v3/pkg/application/options_application_test.go deleted file mode 100644 index 2e274e2f7..000000000 --- a/v3/pkg/application/options_application_test.go +++ /dev/null @@ -1,123 +0,0 @@ -package application - -import ( - "reflect" - "testing" -) - -func TestOptions_getOptions(t *testing.T) { - - tests := []struct { - name string - input Options - debugMode bool - want Options - }{ - { - name: "Override Icon in Production", - input: Options{ - Icon: []byte("debug-icon"), - ProductionOverrides: &Options{ - Icon: []byte("prod-icon"), - }, - }, - want: Options{ - Icon: []byte("prod-icon"), - }, - }, - { - name: "Don't override Icon in debug", - input: Options{ - Icon: []byte("debug-icon"), - ProductionOverrides: &Options{ - Icon: []byte("prod-icon"), - }, - }, - debugMode: true, - want: Options{ - Icon: []byte("debug-icon"), - }, - }, - { - name: "Override Mac in Production", - input: Options{ - Mac: MacOptions{ - ApplicationShouldTerminateAfterLastWindowClosed: false, - }, - ProductionOverrides: &Options{ - Mac: MacOptions{ - ApplicationShouldTerminateAfterLastWindowClosed: true, - }, - }, - }, - want: Options{ - Mac: MacOptions{ - ApplicationShouldTerminateAfterLastWindowClosed: true, - }, - }, - }, - { - name: "Don't override Mac in debug", - input: Options{ - Mac: MacOptions{ - ApplicationShouldTerminateAfterLastWindowClosed: false, - }, - ProductionOverrides: &Options{ - Mac: MacOptions{ - ApplicationShouldTerminateAfterLastWindowClosed: true, - }, - }, - }, - debugMode: true, - want: Options{ - Mac: MacOptions{ - ApplicationShouldTerminateAfterLastWindowClosed: false, - }, - }, - }, - { - name: "Override Flags in Production", - input: Options{ - Flags: map[string]interface{}{ - "environment": "debug", - }, - ProductionOverrides: &Options{ - Flags: map[string]interface{}{ - "environment": "prod", - }, - }, - }, - want: Options{ - Flags: map[string]interface{}{ - "environment": "prod", - }, - }, - }, - { - name: "Do not override Flags in debug", - input: Options{ - Flags: map[string]interface{}{ - "environment": "debug", - }, - ProductionOverrides: &Options{ - Flags: map[string]interface{}{ - "environment": "prod", - }, - }, - }, - debugMode: true, - want: Options{ - Flags: map[string]interface{}{ - "environment": "debug", - }, - }, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - if got := tt.input.getOptions(tt.debugMode); !reflect.DeepEqual(got, tt.want) { - t.Errorf("getOptions() = %v, want %v", got, tt.want) - } - }) - } -}