From c05cec6d504a0e3c9f1f062524a5eab1eb3903fc Mon Sep 17 00:00:00 2001 From: Sean O'Neill Date: Tue, 7 Dec 2021 10:18:12 +0000 Subject: [PATCH] more lint fixes --- internal/configs/parsing_helpers.go | 2 +- internal/configs/version2/http.go | 1 + internal/configs/warnings.go | 4 ++-- internal/k8s/configuration_test.go | 10 ++++----- internal/k8s/controller.go | 4 +++- internal/k8s/reference_checkers.go | 24 ++++++++++----------- internal/k8s/secrets/store.go | 2 +- internal/k8s/spiffe.go | 11 +++++----- internal/metrics/collectors/controller.go | 8 +++---- internal/metrics/collectors/manager.go | 6 +++--- internal/nginx/fake_manager.go | 26 +++++++++++------------ internal/nginx/manager.go | 12 +++++++---- internal/nginx/verify_test.go | 2 +- pkg/apis/configuration/register.go | 1 + pkg/apis/configuration/v1/register.go | 4 +++- pkg/apis/dos/v1beta1/register.go | 4 +++- 16 files changed, 67 insertions(+), 54 deletions(-) diff --git a/internal/configs/parsing_helpers.go b/internal/configs/parsing_helpers.go index d8c6db7986..f785486b11 100644 --- a/internal/configs/parsing_helpers.go +++ b/internal/configs/parsing_helpers.go @@ -79,7 +79,7 @@ func GetMapKeyAsUint64(m map[string]string, key string, context apiObject, nonZe } // GetMapKeyAsStringSlice tries to find and parse a key in the map as string slice splitting it on delimiter. -func GetMapKeyAsStringSlice(m map[string]string, key string, context apiObject, delimiter string) ([]string, bool, error) { +func GetMapKeyAsStringSlice(m map[string]string, key string, _ apiObject, delimiter string) ([]string, bool, error) { if str, exists := m[key]; exists { slice := strings.Split(str, delimiter) return slice, exists, nil diff --git a/internal/configs/version2/http.go b/internal/configs/version2/http.go index 3edd700f6c..0ec8355498 100644 --- a/internal/configs/version2/http.go +++ b/internal/configs/version2/http.go @@ -107,6 +107,7 @@ type EgressMTLS struct { SSLName string } +// OIDC holds OIDC configuration data. type OIDC struct { AuthEndpoint string ClientID string diff --git a/internal/configs/warnings.go b/internal/configs/warnings.go index 6a335312f3..6084728629 100644 --- a/internal/configs/warnings.go +++ b/internal/configs/warnings.go @@ -20,12 +20,12 @@ func (w Warnings) Add(warnings Warnings) { } } -// Adds a warning for the specified object using the provided format and arguments. +// AddWarningf Adds a warning for the specified object using the provided format and arguments. func (w Warnings) AddWarningf(obj runtime.Object, msgFmt string, args ...interface{}) { w[obj] = append(w[obj], fmt.Sprintf(msgFmt, args...)) } -// Adds a warning for the specified object. +// AddWarning Adds a warning for the specified object. func (w Warnings) AddWarning(obj runtime.Object, msg string) { w[obj] = append(w[obj], msg) } diff --git a/internal/k8s/configuration_test.go b/internal/k8s/configuration_test.go index 0aadfd7777..69942920f4 100644 --- a/internal/k8s/configuration_test.go +++ b/internal/k8s/configuration_test.go @@ -3048,23 +3048,23 @@ type testReferenceChecker struct { onlyTransportServers bool } -func (rc *testReferenceChecker) IsReferencedByIngress(namespace string, name string, ing *networking.Ingress) bool { +func (rc *testReferenceChecker) IsReferencedByIngress(namespace string, name string, _ *networking.Ingress) bool { return rc.onlyIngresses && namespace == rc.resourceNamespace && name == rc.resourceName } -func (rc *testReferenceChecker) IsReferencedByMinion(namespace string, name string, ing *networking.Ingress) bool { +func (rc *testReferenceChecker) IsReferencedByMinion(namespace string, name string, _ *networking.Ingress) bool { return rc.onlyMinions && namespace == rc.resourceNamespace && name == rc.resourceName } -func (rc *testReferenceChecker) IsReferencedByVirtualServer(namespace string, name string, vs *conf_v1.VirtualServer) bool { +func (rc *testReferenceChecker) IsReferencedByVirtualServer(namespace string, name string, _ *conf_v1.VirtualServer) bool { return rc.onlyVirtualServers && namespace == rc.resourceNamespace && name == rc.resourceName } -func (rc *testReferenceChecker) IsReferencedByVirtualServerRoute(namespace string, name string, vsr *conf_v1.VirtualServerRoute) bool { +func (rc *testReferenceChecker) IsReferencedByVirtualServerRoute(namespace string, name string, _ *conf_v1.VirtualServerRoute) bool { return rc.onlyVirtualServerRoutes && namespace == rc.resourceNamespace && name == rc.resourceName } -func (rc *testReferenceChecker) IsReferencedByTransportServer(namespace string, name string, ts *conf_v1alpha1.TransportServer) bool { +func (rc *testReferenceChecker) IsReferencedByTransportServer(namespace string, name string, _ *conf_v1alpha1.TransportServer) bool { return rc.onlyTransportServers && namespace == rc.resourceNamespace && name == rc.resourceName } diff --git a/internal/k8s/controller.go b/internal/k8s/controller.go index 9c47914fe8..63bb33c2ee 100644 --- a/internal/k8s/controller.go +++ b/internal/k8s/controller.go @@ -147,7 +147,7 @@ type LoadBalancerController struct { metricsCollector collectors.ControllerCollector globalConfigurationValidator *validation.GlobalConfigurationValidator transportServerValidator *validation.TransportServerValidator - spiffeController *spiffeController + spiffeController *SpiffeController internalRoutesEnabled bool syncLock sync.Mutex isNginxReady bool @@ -1381,6 +1381,7 @@ func (lbc *LoadBalancerController) updateTransportServerStatusAndEventsOnDelete( } } +// UpdateVirtualServerStatusAndEventsOnDelete updates the virtual server status and events func (lbc *LoadBalancerController) UpdateVirtualServerStatusAndEventsOnDelete(vsConfig *VirtualServerConfiguration, changeError string, deleteErr error) { eventType := api_v1.EventTypeWarning eventTitle := "Rejected" @@ -1422,6 +1423,7 @@ func (lbc *LoadBalancerController) UpdateVirtualServerStatusAndEventsOnDelete(vs // for each VSR, a dedicated problem exists } +// UpdateIngressStatusAndEventsOnDelete updates the ingress status and events. func (lbc *LoadBalancerController) UpdateIngressStatusAndEventsOnDelete(ingConfig *IngressConfiguration, changeError string, deleteErr error) { eventTitle := "Rejected" eventWarningMessage := "" diff --git a/internal/k8s/reference_checkers.go b/internal/k8s/reference_checkers.go index 331262c4fd..5878553c2e 100644 --- a/internal/k8s/reference_checkers.go +++ b/internal/k8s/reference_checkers.go @@ -75,11 +75,11 @@ func (rc *secretReferenceChecker) IsReferencedByVirtualServer(secretNamespace st return false } -func (rc *secretReferenceChecker) IsReferencedByVirtualServerRoute(secretNamespace string, secretName string, vsr *v1.VirtualServerRoute) bool { +func (rc *secretReferenceChecker) IsReferencedByVirtualServerRoute(_ string, _ string, _ *v1.VirtualServerRoute) bool { return false } -func (rc *secretReferenceChecker) IsReferencedByTransportServer(secretNamespace string, secretName string, ts *conf_v1alpha1.TransportServer) bool { +func (rc *secretReferenceChecker) IsReferencedByTransportServer(_ string, _ string, _ *conf_v1alpha1.TransportServer) bool { return false } @@ -173,11 +173,11 @@ func newPolicyReferenceChecker() *policyReferenceChecker { return &policyReferenceChecker{} } -func (rc *policyReferenceChecker) IsReferencedByIngress(policyNamespace string, policyName string, ing *networking.Ingress) bool { +func (rc *policyReferenceChecker) IsReferencedByIngress(_ string, _ string, _ *networking.Ingress) bool { return false } -func (rc *policyReferenceChecker) IsReferencedByMinion(policyNamespace string, policyName string, ing *networking.Ingress) bool { +func (rc *policyReferenceChecker) IsReferencedByMinion(_ string, _ string, _ *networking.Ingress) bool { return false } @@ -205,7 +205,7 @@ func (rc *policyReferenceChecker) IsReferencedByVirtualServerRoute(policyNamespa return false } -func (rc *policyReferenceChecker) IsReferencedByTransportServer(policyNamespace string, policyName string, ts *conf_v1alpha1.TransportServer) bool { +func (rc *policyReferenceChecker) IsReferencedByTransportServer(_ string, _ string, _ *conf_v1alpha1.TransportServer) bool { return false } @@ -231,19 +231,19 @@ func (rc *appProtectResourceReferenceChecker) IsReferencedByIngress(namespace st return false } -func (rc *appProtectResourceReferenceChecker) IsReferencedByMinion(namespace string, name string, ing *networking.Ingress) bool { +func (rc *appProtectResourceReferenceChecker) IsReferencedByMinion(_ string, _ string, _ *networking.Ingress) bool { return false } -func (rc *appProtectResourceReferenceChecker) IsReferencedByVirtualServer(namespace string, name string, vs *v1.VirtualServer) bool { +func (rc *appProtectResourceReferenceChecker) IsReferencedByVirtualServer(_ string, _ string, _ *v1.VirtualServer) bool { return false } -func (rc *appProtectResourceReferenceChecker) IsReferencedByVirtualServerRoute(namespace string, name string, vsr *v1.VirtualServerRoute) bool { +func (rc *appProtectResourceReferenceChecker) IsReferencedByVirtualServerRoute(_ string, _ string, _ *v1.VirtualServerRoute) bool { return false } -func (rc *appProtectResourceReferenceChecker) IsReferencedByTransportServer(namespace string, name string, ts *conf_v1alpha1.TransportServer) bool { +func (rc *appProtectResourceReferenceChecker) IsReferencedByTransportServer(_ string, _ string, _ *conf_v1alpha1.TransportServer) bool { return false } @@ -278,7 +278,7 @@ func (rc *dosResourceReferenceChecker) IsReferencedByIngress(namespace string, n return res == namespace+"/"+name || (namespace == ing.Namespace && res == name) } -func (rc *dosResourceReferenceChecker) IsReferencedByMinion(namespace string, name string, ing *networking.Ingress) bool { +func (rc *dosResourceReferenceChecker) IsReferencedByMinion(_ string, _ string, _ *networking.Ingress) bool { return false } @@ -294,10 +294,10 @@ func (rc *dosResourceReferenceChecker) IsReferencedByVirtualServer(namespace str return false } -func (rc *dosResourceReferenceChecker) IsReferencedByVirtualServerRoute(namespace string, name string, vsr *v1.VirtualServerRoute) bool { +func (rc *dosResourceReferenceChecker) IsReferencedByVirtualServerRoute(_ string, _ string, _ *v1.VirtualServerRoute) bool { return false } -func (rc *dosResourceReferenceChecker) IsReferencedByTransportServer(namespace string, name string, ts *conf_v1alpha1.TransportServer) bool { +func (rc *dosResourceReferenceChecker) IsReferencedByTransportServer(_ string, _ string, _ *conf_v1alpha1.TransportServer) bool { return false } diff --git a/internal/k8s/secrets/store.go b/internal/k8s/secrets/store.go index e3d356134c..3352fe910c 100644 --- a/internal/k8s/secrets/store.go +++ b/internal/k8s/secrets/store.go @@ -136,7 +136,7 @@ func (s *FakeSecretStore) AddOrUpdateSecret(secret *api_v1.Secret) { } // DeleteSecret is a fake implementation of DeleteSecret. -func (s *FakeSecretStore) DeleteSecret(key string) { +func (s *FakeSecretStore) DeleteSecret(_ string) { } // GetSecret is a fake implementation of GetSecret. diff --git a/internal/k8s/spiffe.go b/internal/k8s/spiffe.go index 53cec979cf..dfb7cfcfb6 100644 --- a/internal/k8s/spiffe.go +++ b/internal/k8s/spiffe.go @@ -10,20 +10,21 @@ import ( "github.com/spiffe/go-spiffe/workload" ) -type spiffeController struct { +// SpiffeController controls spiffe +type SpiffeController struct { watcher *spiffeWatcher client *workload.X509SVIDClient } // NewSpiffeController creates the spiffeWatcher and the Spiffe Workload API Client, // returns an error if the client cannot connect to the Spire Agent. -func NewSpiffeController(sync func(*workload.X509SVIDs), spireAgentAddr string) (*spiffeController, error) { +func NewSpiffeController(sync func(*workload.X509SVIDs), spireAgentAddr string) (*SpiffeController, error) { watcher := &spiffeWatcher{sync: sync} client, err := workload.NewX509SVIDClient(watcher, workload.WithAddr("unix://"+spireAgentAddr)) if err != nil { return nil, fmt.Errorf("failed to create Spiffe Workload API Client: %w", err) } - sc := &spiffeController{ + sc := &SpiffeController{ watcher: watcher, client: client, } @@ -33,7 +34,7 @@ func NewSpiffeController(sync func(*workload.X509SVIDs), spireAgentAddr string) // Start starts the Spiffe Workload API Client and waits for the Spiffe certs to be written to disk. // If the certs are not available after 30 seconds an error is returned. // On success, calls onStart function and kicks off the Spiffe Controller's run loop. -func (sc *spiffeController) Start(stopCh <-chan struct{}, onStart func()) error { +func (sc *SpiffeController) Start(stopCh <-chan struct{}, onStart func()) error { glog.V(3).Info("Starting SPIFFE Workload API Client") err := sc.client.Start() if err != nil { @@ -62,7 +63,7 @@ func (sc *spiffeController) Start(stopCh <-chan struct{}, onStart func()) error } // Run waits until a message is sent on the stop channel and stops the Spiffe Workload API Client. -func (sc *spiffeController) Run(stopCh <-chan struct{}) { +func (sc *SpiffeController) Run(stopCh <-chan struct{}) { <-stopCh err := sc.client.Stop() if err != nil { diff --git a/internal/metrics/collectors/controller.go b/internal/metrics/collectors/controller.go index 5c89aab4e0..b6c108b6ca 100644 --- a/internal/metrics/collectors/controller.go +++ b/internal/metrics/collectors/controller.go @@ -144,16 +144,16 @@ func NewControllerFakeCollector() *ControllerFakeCollector { } // Register implements a fake Register -func (cc *ControllerFakeCollector) Register(registry *prometheus.Registry) error { return nil } +func (cc *ControllerFakeCollector) Register(_ *prometheus.Registry) error { return nil } // SetIngresses implements a fake SetIngresses -func (cc *ControllerFakeCollector) SetIngresses(ingressType string, count int) {} +func (cc *ControllerFakeCollector) SetIngresses(_ string, _ int) {} // SetVirtualServers implements a fake SetVirtualServers -func (cc *ControllerFakeCollector) SetVirtualServers(count int) {} +func (cc *ControllerFakeCollector) SetVirtualServers(_ int) {} // SetVirtualServerRoutes implements a fake SetVirtualServerRoutes -func (cc *ControllerFakeCollector) SetVirtualServerRoutes(count int) {} +func (cc *ControllerFakeCollector) SetVirtualServerRoutes(_ int) {} // SetTransportServers implements a fake SetTransportServers func (cc *ControllerFakeCollector) SetTransportServers(int, int, int) {} diff --git a/internal/metrics/collectors/manager.go b/internal/metrics/collectors/manager.go index 1c64de5b4d..2aa1e46786 100644 --- a/internal/metrics/collectors/manager.go +++ b/internal/metrics/collectors/manager.go @@ -127,13 +127,13 @@ func NewManagerFakeCollector() *ManagerFakeCollector { } // Register implements a fake Register -func (nc *ManagerFakeCollector) Register(registry *prometheus.Registry) error { return nil } +func (nc *ManagerFakeCollector) Register(_ *prometheus.Registry) error { return nil } // IncNginxReloadCount implements a fake IncNginxReloadCount -func (nc *ManagerFakeCollector) IncNginxReloadCount(isEndPointUpdate bool) {} +func (nc *ManagerFakeCollector) IncNginxReloadCount(_ bool) {} // IncNginxReloadErrors implements a fake IncNginxReloadErrors func (nc *ManagerFakeCollector) IncNginxReloadErrors() {} // UpdateLastReloadTime implements a fake UpdateLastReloadTime -func (nc *ManagerFakeCollector) UpdateLastReloadTime(ms time.Duration) {} +func (nc *ManagerFakeCollector) UpdateLastReloadTime(_ time.Duration) {} diff --git a/internal/nginx/fake_manager.go b/internal/nginx/fake_manager.go index 29f63493a0..d2448600f2 100644 --- a/internal/nginx/fake_manager.go +++ b/internal/nginx/fake_manager.go @@ -70,12 +70,12 @@ func (*FakeManager) DeleteStreamConfig(name string) { } // CreateTLSPassthroughHostsConfig provides a fake implementation of CreateTLSPassthroughHostsConfig. -func (*FakeManager) CreateTLSPassthroughHostsConfig(content []byte) { +func (*FakeManager) CreateTLSPassthroughHostsConfig(_ []byte) { glog.V(3).Infof("Writing TLS Passthrough Hosts config file") } // CreateSecret provides a fake implementation of CreateSecret. -func (fm *FakeManager) CreateSecret(name string, content []byte, mode os.FileMode) string { +func (fm *FakeManager) CreateSecret(name string, _ []byte, _ os.FileMode) string { glog.V(3).Infof("Writing secret %v", name) return fm.GetFilenameForSecret(name) } @@ -91,7 +91,7 @@ func (fm *FakeManager) GetFilenameForSecret(name string) string { } // CreateDHParam provides a fake implementation of CreateDHParam. -func (fm *FakeManager) CreateDHParam(content string) (string, error) { +func (fm *FakeManager) CreateDHParam(_ string) (string, error) { glog.V(3).Infof("Writing dhparam file") return fm.dhparamFilename, nil } @@ -103,12 +103,12 @@ func (*FakeManager) Version() string { } // Start provides a fake implementation of Start. -func (*FakeManager) Start(done chan error) { +func (*FakeManager) Start(_ chan error) { glog.V(3).Info("Starting nginx") } // Reload provides a fake implementation of Reload. -func (*FakeManager) Reload(isEndpointsUpdate bool) error { +func (*FakeManager) Reload(_ bool) error { glog.V(3).Infof("Reloading nginx") return nil } @@ -119,16 +119,16 @@ func (*FakeManager) Quit() { } // UpdateConfigVersionFile provides a fake implementation of UpdateConfigVersionFile. -func (*FakeManager) UpdateConfigVersionFile(openTracing bool) { +func (*FakeManager) UpdateConfigVersionFile(_ bool) { glog.V(3).Infof("Writing config version") } // SetPlusClients provides a fake implementation of SetPlusClients. -func (*FakeManager) SetPlusClients(plusClient *client.NginxClient, plusConfigVersionCheckClient *http.Client) { +func (*FakeManager) SetPlusClients(_ *client.NginxClient, _ *http.Client) { } // UpdateServersInPlus provides a fake implementation of UpdateServersInPlus. -func (*FakeManager) UpdateServersInPlus(upstream string, servers []string, config ServerConfig) error { +func (*FakeManager) UpdateServersInPlus(upstream string, servers []string, _ ServerConfig) error { glog.V(3).Infof("Updating servers of %v: %v", upstream, servers) return nil } @@ -140,18 +140,18 @@ func (*FakeManager) UpdateStreamServersInPlus(upstream string, servers []string) } // CreateOpenTracingTracerConfig creates a fake implementation of CreateOpenTracingTracerConfig. -func (*FakeManager) CreateOpenTracingTracerConfig(content string) error { +func (*FakeManager) CreateOpenTracingTracerConfig(_ string) error { glog.V(3).Infof("Writing OpenTracing tracer config file") return nil } // SetOpenTracing creates a fake implementation of SetOpenTracing. -func (*FakeManager) SetOpenTracing(openTracing bool) { +func (*FakeManager) SetOpenTracing(_ bool) { } // AppProtectAgentStart is a fake implementation of AppProtectAgentStart -func (*FakeManager) AppProtectAgentStart(apaDone chan error, debug bool) { +func (*FakeManager) AppProtectAgentStart(_ chan error, _ bool) { glog.V(3).Infof("Starting FakeAppProtectAgent") } @@ -161,7 +161,7 @@ func (*FakeManager) AppProtectAgentQuit() { } // AppProtectPluginStart is a fake implementtion AppProtectPluginStart -func (*FakeManager) AppProtectPluginStart(appDone chan error) { +func (*FakeManager) AppProtectPluginStart(_ chan error) { glog.V(3).Infof("Starting FakeAppProtectPlugin") } @@ -176,6 +176,6 @@ func (*FakeManager) AppProtectDosAgentQuit() { } // AppProtectDosAgentStart is a fake implementation of AppProtectAgentStart -func (*FakeManager) AppProtectDosAgentStart(apdaDone chan error, debug bool, maxDaemon int, maxWorkers int, memory int) { +func (*FakeManager) AppProtectDosAgentStart(_ chan error, _ bool, _ int, _ int, _ int) { glog.V(3).Infof("Starting FakeAppProtectDosAgent") } diff --git a/internal/nginx/manager.go b/internal/nginx/manager.go index 79b695726e..9ea835e60c 100644 --- a/internal/nginx/manager.go +++ b/internal/nginx/manager.go @@ -18,10 +18,14 @@ import ( ) const ( - ReloadForEndpointsUpdate = true // ReloadForEndpointsUpdate means that is caused by an endpoints update. - ReloadForOtherUpdate = false // ReloadForOtherUpdate means that a reload is caused by an update for a resource(s) other than endpoints. - TLSSecretFileMode = 0o600 // TLSSecretFileMode defines the default filemode for files with TLS Secrets. - JWKSecretFileMode = 0o644 // JWKSecretFileMode defines the default filemode for files with JWK Secrets. + // ReloadForEndpointsUpdate means that is caused by an endpoints update. + ReloadForEndpointsUpdate = true + // ReloadForOtherUpdate means that a reload is caused by an update for a resource(s) other than endpoints. + ReloadForOtherUpdate = false + // TLSSecretFileMode defines the default filemode for files with TLS Secrets. + TLSSecretFileMode = 0o600 + // JWKSecretFileMode defines the default filemode for files with JWK Secrets. + JWKSecretFileMode = 0o644 configFileMode = 0o644 jsonFileForOpenTracingTracer = "/var/lib/nginx/tracer-config.json" nginxBinaryPath = "/usr/sbin/nginx" diff --git a/internal/nginx/verify_test.go b/internal/nginx/verify_test.go index 58281bc134..30e72b0cf5 100644 --- a/internal/nginx/verify_test.go +++ b/internal/nginx/verify_test.go @@ -11,7 +11,7 @@ import ( type Transport struct{} -func (c Transport) RoundTrip(req *http.Request) (*http.Response, error) { +func (c Transport) RoundTrip(_ *http.Request) (*http.Response, error) { return &http.Response{ StatusCode: 200, Body: ioutil.NopCloser(bytes.NewBufferString("42")), diff --git a/pkg/apis/configuration/register.go b/pkg/apis/configuration/register.go index 04d4f2973a..4aa7c94519 100644 --- a/pkg/apis/configuration/register.go +++ b/pkg/apis/configuration/register.go @@ -1,5 +1,6 @@ package configuration const ( + // GroupName is the name of the group. GroupName = "k8s.nginx.org" ) diff --git a/pkg/apis/configuration/v1/register.go b/pkg/apis/configuration/v1/register.go index 5adaf25a27..73924e09d8 100644 --- a/pkg/apis/configuration/v1/register.go +++ b/pkg/apis/configuration/v1/register.go @@ -21,8 +21,10 @@ func Resource(resource string) schema.GroupResource { } var ( + // SchemeBuilder builds a scheme SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) - AddToScheme = SchemeBuilder.AddToScheme + // AddToScheme adds to a scheme + AddToScheme = SchemeBuilder.AddToScheme ) // Adds the list of known types to Scheme. diff --git a/pkg/apis/dos/v1beta1/register.go b/pkg/apis/dos/v1beta1/register.go index 504033d0bc..d527b6a37f 100644 --- a/pkg/apis/dos/v1beta1/register.go +++ b/pkg/apis/dos/v1beta1/register.go @@ -21,8 +21,10 @@ func Resource(resource string) schema.GroupResource { } var ( + // SchemeBuilder builds a scheme SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) - AddToScheme = SchemeBuilder.AddToScheme + // AddToScheme a function to add to a scheme + AddToScheme = SchemeBuilder.AddToScheme ) // Adds the list of known types to Scheme.