diff --git a/api/builtinconfig/loaddefaultconfig_test.go b/api/builtinconfig/loaddefaultconfig_test.go index a1b133708..f5185a836 100644 --- a/api/builtinconfig/loaddefaultconfig_test.go +++ b/api/builtinconfig/loaddefaultconfig_test.go @@ -7,9 +7,9 @@ import ( "reflect" "testing" + "sigs.k8s.io/kustomize/v3/api/internal/loadertest" "sigs.k8s.io/kustomize/v3/api/resid" "sigs.k8s.io/kustomize/v3/api/types" - "sigs.k8s.io/kustomize/v3/internal/loadertest" ) func TestLoadDefaultConfigsFromFiles(t *testing.T) { diff --git a/api/internal/git/cloner.go b/api/git/cloner.go similarity index 100% rename from api/internal/git/cloner.go rename to api/git/cloner.go diff --git a/api/internal/git/repospec.go b/api/git/repospec.go similarity index 100% rename from api/internal/git/repospec.go rename to api/git/repospec.go diff --git a/api/internal/git/repospec_test.go b/api/git/repospec_test.go similarity index 100% rename from api/internal/git/repospec_test.go rename to api/git/repospec_test.go diff --git a/api/accumulator/expansion/expand.go b/api/internal/accumulator/expansion/expand.go similarity index 100% rename from api/accumulator/expansion/expand.go rename to api/internal/accumulator/expansion/expand.go diff --git a/api/accumulator/expansion/expand_test.go b/api/internal/accumulator/expansion/expand_test.go similarity index 99% rename from api/accumulator/expansion/expand_test.go rename to api/internal/accumulator/expansion/expand_test.go index 8f61ac156..d974841ed 100644 --- a/api/accumulator/expansion/expand_test.go +++ b/api/internal/accumulator/expansion/expand_test.go @@ -7,7 +7,7 @@ import ( "fmt" "testing" - . "sigs.k8s.io/kustomize/v3/api/accumulator/expansion" + . "sigs.k8s.io/kustomize/v3/api/internal/accumulator/expansion" ) type expected struct { diff --git a/api/accumulator/loadconfigfromcrds.go b/api/internal/accumulator/loadconfigfromcrds.go similarity index 100% rename from api/accumulator/loadconfigfromcrds.go rename to api/internal/accumulator/loadconfigfromcrds.go diff --git a/api/accumulator/loadconfigfromcrds_test.go b/api/internal/accumulator/loadconfigfromcrds_test.go similarity index 98% rename from api/accumulator/loadconfigfromcrds_test.go rename to api/internal/accumulator/loadconfigfromcrds_test.go index 53baaeda0..55ed307da 100644 --- a/api/accumulator/loadconfigfromcrds_test.go +++ b/api/internal/accumulator/loadconfigfromcrds_test.go @@ -7,12 +7,12 @@ import ( "reflect" "testing" - . "sigs.k8s.io/kustomize/v3/api/accumulator" "sigs.k8s.io/kustomize/v3/api/builtinconfig" "sigs.k8s.io/kustomize/v3/api/ifc" + . "sigs.k8s.io/kustomize/v3/api/internal/accumulator" + "sigs.k8s.io/kustomize/v3/api/internal/loadertest" "sigs.k8s.io/kustomize/v3/api/resid" "sigs.k8s.io/kustomize/v3/api/types" - "sigs.k8s.io/kustomize/v3/internal/loadertest" ) // This defines two CRD's: Bee and MyKind. diff --git a/api/accumulator/namereferencetransformer.go b/api/internal/accumulator/namereferencetransformer.go similarity index 100% rename from api/accumulator/namereferencetransformer.go rename to api/internal/accumulator/namereferencetransformer.go diff --git a/api/accumulator/namereferencetransformer_test.go b/api/internal/accumulator/namereferencetransformer_test.go similarity index 100% rename from api/accumulator/namereferencetransformer_test.go rename to api/internal/accumulator/namereferencetransformer_test.go diff --git a/api/accumulator/refvartransformer.go b/api/internal/accumulator/refvartransformer.go similarity index 91% rename from api/accumulator/refvartransformer.go rename to api/internal/accumulator/refvartransformer.go index f5c394abe..42b5e580c 100644 --- a/api/accumulator/refvartransformer.go +++ b/api/internal/accumulator/refvartransformer.go @@ -6,7 +6,8 @@ package accumulator import ( "fmt" - "sigs.k8s.io/kustomize/v3/api/accumulator/expansion" + expansion2 "sigs.k8s.io/kustomize/v3/api/internal/accumulator/expansion" + "sigs.k8s.io/kustomize/v3/api/resmap" "sigs.k8s.io/kustomize/v3/api/transform" "sigs.k8s.io/kustomize/v3/api/types" @@ -39,7 +40,7 @@ func (rv *refVarTransformer) replaceVars(in interface{}) (interface{}, error) { case []interface{}: var xs []interface{} for _, a := range in.([]interface{}) { - xs = append(xs, expansion.Expand(a.(string), rv.mappingFunc)) + xs = append(xs, expansion2.Expand(a.(string), rv.mappingFunc)) } return xs, nil case map[string]interface{}: @@ -56,7 +57,7 @@ func (rv *refVarTransformer) replaceVars(in interface{}) (interface{}, error) { // This field can potentially contains a $(VAR) since it is // of string type. For instance .spec.replicas: $(REPLICAS) // in a Deployment object - xs[k] = expansion.Expand(s, rv.mappingFunc) + xs[k] = expansion2.Expand(s, rv.mappingFunc) } } return xs, nil @@ -68,7 +69,7 @@ func (rv *refVarTransformer) replaceVars(in interface{}) (interface{}, error) { } // This field can potentially contain a $(VAR) since it is // of string type. - return expansion.Expand(s, rv.mappingFunc), nil + return expansion2.Expand(s, rv.mappingFunc), nil case nil: return nil, nil default: @@ -92,7 +93,7 @@ func (rv *refVarTransformer) UnusedVars() []string { // Transform replaces $(VAR) style variables with values. func (rv *refVarTransformer) Transform(m resmap.ResMap) error { rv.replacementCounts = make(map[string]int) - rv.mappingFunc = expansion.MappingFuncFor( + rv.mappingFunc = expansion2.MappingFuncFor( rv.replacementCounts, rv.varMap) for _, res := range m.Resources() { for _, fieldSpec := range rv.fieldSpecs { diff --git a/api/accumulator/refvartransformer_test.go b/api/internal/accumulator/refvartransformer_test.go similarity index 100% rename from api/accumulator/refvartransformer_test.go rename to api/internal/accumulator/refvartransformer_test.go diff --git a/api/accumulator/resaccumulator.go b/api/internal/accumulator/resaccumulator.go similarity index 100% rename from api/accumulator/resaccumulator.go rename to api/internal/accumulator/resaccumulator.go diff --git a/api/accumulator/resaccumulator_test.go b/api/internal/accumulator/resaccumulator_test.go similarity index 99% rename from api/accumulator/resaccumulator_test.go rename to api/internal/accumulator/resaccumulator_test.go index 4b8209543..0fcc5225a 100644 --- a/api/accumulator/resaccumulator_test.go +++ b/api/internal/accumulator/resaccumulator_test.go @@ -10,8 +10,8 @@ import ( "strings" "testing" - . "sigs.k8s.io/kustomize/v3/api/accumulator" "sigs.k8s.io/kustomize/v3/api/builtinconfig" + . "sigs.k8s.io/kustomize/v3/api/internal/accumulator" "sigs.k8s.io/kustomize/v3/api/resid" "sigs.k8s.io/kustomize/v3/api/resmap" "sigs.k8s.io/kustomize/v3/api/resource" diff --git a/internal/kusterr/yamlformaterror.go b/api/internal/kusterr/yamlformaterror.go similarity index 56% rename from internal/kusterr/yamlformaterror.go rename to api/internal/kusterr/yamlformaterror.go index 74b5ef33f..950ffea8a 100644 --- a/internal/kusterr/yamlformaterror.go +++ b/api/internal/kusterr/yamlformaterror.go @@ -1,18 +1,5 @@ -/* -Copyright 2018 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ +// Copyright 2019 The Kubernetes Authors. +// SPDX-License-Identifier: Apache-2.0 // Package error has contextual error types. package kusterr diff --git a/internal/kusterr/yamlformaterror_test.go b/api/internal/kusterr/yamlformaterror_test.go similarity index 68% rename from internal/kusterr/yamlformaterror_test.go rename to api/internal/kusterr/yamlformaterror_test.go index 2354d1ca8..67cd77146 100644 --- a/internal/kusterr/yamlformaterror_test.go +++ b/api/internal/kusterr/yamlformaterror_test.go @@ -1,18 +1,5 @@ -/* -Copyright 2018 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ +// Copyright 2019 The Kubernetes Authors. +// SPDX-License-Identifier: Apache-2.0 package kusterr diff --git a/internal/loadertest/fakeloader.go b/api/internal/loadertest/fakeloader.go similarity index 100% rename from internal/loadertest/fakeloader.go rename to api/internal/loadertest/fakeloader.go diff --git a/internal/tools/tools.go b/api/internal/tools/tools.go similarity index 100% rename from internal/tools/tools.go rename to api/internal/tools/tools.go diff --git a/api/loader/fileloader.go b/api/loader/fileloader.go index e7822bbe6..cd25e5302 100644 --- a/api/loader/fileloader.go +++ b/api/loader/fileloader.go @@ -10,8 +10,8 @@ import ( "strings" "sigs.k8s.io/kustomize/v3/api/filesys" + "sigs.k8s.io/kustomize/v3/api/git" "sigs.k8s.io/kustomize/v3/api/ifc" - "sigs.k8s.io/kustomize/v3/api/internal/git" ) // fileLoader is a kustomization's interface to files. diff --git a/api/loader/fileloader_test.go b/api/loader/fileloader_test.go index 4e2358081..eeebb3be0 100644 --- a/api/loader/fileloader_test.go +++ b/api/loader/fileloader_test.go @@ -13,8 +13,8 @@ import ( "testing" "sigs.k8s.io/kustomize/v3/api/filesys" + "sigs.k8s.io/kustomize/v3/api/git" "sigs.k8s.io/kustomize/v3/api/ifc" - "sigs.k8s.io/kustomize/v3/api/internal/git" "sigs.k8s.io/kustomize/v3/api/pgmconfig" ) diff --git a/api/loader/loader.go b/api/loader/loader.go index 10880f936..e351995ff 100644 --- a/api/loader/loader.go +++ b/api/loader/loader.go @@ -6,8 +6,8 @@ package loader import ( "sigs.k8s.io/kustomize/v3/api/filesys" + "sigs.k8s.io/kustomize/v3/api/git" "sigs.k8s.io/kustomize/v3/api/ifc" - "sigs.k8s.io/kustomize/v3/api/internal/git" ) // NewLoader returns a Loader pointed at the given target. diff --git a/api/plugins/execplugin/execplugin_test.go b/api/plugins/execplugin/execplugin_test.go index 605151d07..b1500aff3 100644 --- a/api/plugins/execplugin/execplugin_test.go +++ b/api/plugins/execplugin/execplugin_test.go @@ -8,6 +8,7 @@ import ( "strings" "testing" + "sigs.k8s.io/kustomize/v3/api/internal/loadertest" "sigs.k8s.io/kustomize/v3/api/plugins/config" . "sigs.k8s.io/kustomize/v3/api/plugins/execplugin" "sigs.k8s.io/kustomize/v3/api/plugins/loader" @@ -15,7 +16,6 @@ import ( "sigs.k8s.io/kustomize/v3/api/resource" "sigs.k8s.io/kustomize/v3/api/testutils/valtest" "sigs.k8s.io/kustomize/v3/api/types" - "sigs.k8s.io/kustomize/v3/internal/loadertest" "sigs.k8s.io/kustomize/v3/k8sdeps/kunstruct" ) diff --git a/api/plugins/loader/loader_test.go b/api/plugins/loader/loader_test.go index deec7a58c..7341d3ac0 100644 --- a/api/plugins/loader/loader_test.go +++ b/api/plugins/loader/loader_test.go @@ -6,13 +6,13 @@ package loader_test import ( "testing" + "sigs.k8s.io/kustomize/v3/api/internal/loadertest" "sigs.k8s.io/kustomize/v3/api/plugins/config" . "sigs.k8s.io/kustomize/v3/api/plugins/loader" "sigs.k8s.io/kustomize/v3/api/resmap" "sigs.k8s.io/kustomize/v3/api/resource" "sigs.k8s.io/kustomize/v3/api/testutils/kusttest" "sigs.k8s.io/kustomize/v3/api/testutils/valtest" - "sigs.k8s.io/kustomize/v3/internal/loadertest" "sigs.k8s.io/kustomize/v3/k8sdeps/kunstruct" ) diff --git a/api/resmap/factory.go b/api/resmap/factory.go index 40be42b94..6f7665254 100644 --- a/api/resmap/factory.go +++ b/api/resmap/factory.go @@ -6,9 +6,9 @@ package resmap import ( "github.com/pkg/errors" "sigs.k8s.io/kustomize/v3/api/ifc" + "sigs.k8s.io/kustomize/v3/api/internal/kusterr" "sigs.k8s.io/kustomize/v3/api/resource" "sigs.k8s.io/kustomize/v3/api/types" - "sigs.k8s.io/kustomize/v3/internal/kusterr" ) // Factory makes instances of ResMap. diff --git a/api/resmap/factory_test.go b/api/resmap/factory_test.go index 43b50ee97..38a3f9bb4 100644 --- a/api/resmap/factory_test.go +++ b/api/resmap/factory_test.go @@ -12,13 +12,13 @@ import ( "sigs.k8s.io/kustomize/v3/api/filesys" "sigs.k8s.io/kustomize/v3/api/ifc" + "sigs.k8s.io/kustomize/v3/api/internal/loadertest" "sigs.k8s.io/kustomize/v3/api/kv" "sigs.k8s.io/kustomize/v3/api/loader" . "sigs.k8s.io/kustomize/v3/api/resmap" "sigs.k8s.io/kustomize/v3/api/testutils/resmaptest" "sigs.k8s.io/kustomize/v3/api/testutils/valtest" "sigs.k8s.io/kustomize/v3/api/types" - "sigs.k8s.io/kustomize/v3/internal/loadertest" ) func TestFromFile(t *testing.T) { diff --git a/api/resource/factory.go b/api/resource/factory.go index 0dff7baf2..cd6092f21 100644 --- a/api/resource/factory.go +++ b/api/resource/factory.go @@ -10,8 +10,8 @@ import ( "strings" "sigs.k8s.io/kustomize/v3/api/ifc" + "sigs.k8s.io/kustomize/v3/api/internal/kusterr" "sigs.k8s.io/kustomize/v3/api/types" - "sigs.k8s.io/kustomize/v3/internal/kusterr" ) // Factory makes instances of Resource. diff --git a/api/resource/factory_test.go b/api/resource/factory_test.go index d25d48ade..a981f5005 100644 --- a/api/resource/factory_test.go +++ b/api/resource/factory_test.go @@ -20,9 +20,9 @@ import ( "reflect" "testing" + "sigs.k8s.io/kustomize/v3/api/internal/loadertest" . "sigs.k8s.io/kustomize/v3/api/resource" "sigs.k8s.io/kustomize/v3/api/types" - "sigs.k8s.io/kustomize/v3/internal/loadertest" ) func TestSliceFromPatches(t *testing.T) { diff --git a/api/target/kusttarget.go b/api/target/kusttarget.go index 4bc481147..542b8710e 100644 --- a/api/target/kusttarget.go +++ b/api/target/kusttarget.go @@ -13,9 +13,9 @@ import ( "strings" "github.com/pkg/errors" - "sigs.k8s.io/kustomize/v3/api/accumulator" "sigs.k8s.io/kustomize/v3/api/builtinconfig" "sigs.k8s.io/kustomize/v3/api/ifc" + "sigs.k8s.io/kustomize/v3/api/internal/accumulator" "sigs.k8s.io/kustomize/v3/api/pgmconfig" "sigs.k8s.io/kustomize/v3/api/plugins/builtins" "sigs.k8s.io/kustomize/v3/api/plugins/loader" diff --git a/api/target/kusttarget_test.go b/api/target/kusttarget_test.go index 87506536b..ba3acf508 100644 --- a/api/target/kusttarget_test.go +++ b/api/target/kusttarget_test.go @@ -10,6 +10,7 @@ import ( "testing" "sigs.k8s.io/kustomize/v3/api/ifc" + "sigs.k8s.io/kustomize/v3/api/internal/loadertest" "sigs.k8s.io/kustomize/v3/api/resid" "sigs.k8s.io/kustomize/v3/api/resmap" "sigs.k8s.io/kustomize/v3/api/resource" @@ -17,7 +18,6 @@ import ( "sigs.k8s.io/kustomize/v3/api/testutils/kusttest" "sigs.k8s.io/kustomize/v3/api/testutils/valtest" "sigs.k8s.io/kustomize/v3/api/types" - "sigs.k8s.io/kustomize/v3/internal/loadertest" ) const ( diff --git a/api/testutils/kusttest/kusttestharness.go b/api/testutils/kusttest/kusttestharness.go index d7c12cc7b..20674d5b0 100644 --- a/api/testutils/kusttest/kusttestharness.go +++ b/api/testutils/kusttest/kusttestharness.go @@ -10,6 +10,7 @@ import ( "testing" "sigs.k8s.io/kustomize/v3/api/builtinconfig/consts" + "sigs.k8s.io/kustomize/v3/api/internal/loadertest" fLdr "sigs.k8s.io/kustomize/v3/api/loader" "sigs.k8s.io/kustomize/v3/api/pgmconfig" "sigs.k8s.io/kustomize/v3/api/plugins/config" @@ -19,7 +20,6 @@ import ( "sigs.k8s.io/kustomize/v3/api/target" "sigs.k8s.io/kustomize/v3/api/testutils/valtest" "sigs.k8s.io/kustomize/v3/api/types" - "sigs.k8s.io/kustomize/v3/internal/loadertest" "sigs.k8s.io/kustomize/v3/k8sdeps/kunstruct" "sigs.k8s.io/kustomize/v3/k8sdeps/transformer" ) diff --git a/internal/crawl/README.md b/hacks/crawl/README.md similarity index 100% rename from internal/crawl/README.md rename to hacks/crawl/README.md diff --git a/internal/crawl/ROADMAP.md b/hacks/crawl/ROADMAP.md similarity index 100% rename from internal/crawl/ROADMAP.md rename to hacks/crawl/ROADMAP.md diff --git a/internal/crawl/backend/search_backend.go b/hacks/crawl/backend/search_backend.go similarity index 100% rename from internal/crawl/backend/search_backend.go rename to hacks/crawl/backend/search_backend.go diff --git a/internal/crawl/cmd/backend/Dockerfile b/hacks/crawl/cmd/backend/Dockerfile similarity index 100% rename from internal/crawl/cmd/backend/Dockerfile rename to hacks/crawl/cmd/backend/Dockerfile diff --git a/internal/crawl/cmd/backend/main.go b/hacks/crawl/cmd/backend/main.go similarity index 100% rename from internal/crawl/cmd/backend/main.go rename to hacks/crawl/cmd/backend/main.go diff --git a/internal/crawl/config/base/kustomization.yaml b/hacks/crawl/config/base/kustomization.yaml similarity index 100% rename from internal/crawl/config/base/kustomization.yaml rename to hacks/crawl/config/base/kustomization.yaml diff --git a/internal/crawl/config/crawler/base/kustomization.yaml b/hacks/crawl/config/crawler/base/kustomization.yaml similarity index 100% rename from internal/crawl/config/crawler/base/kustomization.yaml rename to hacks/crawl/config/crawler/base/kustomization.yaml diff --git a/internal/crawl/config/crawler/cronjob/cronjob.yaml b/hacks/crawl/config/crawler/cronjob/cronjob.yaml similarity index 100% rename from internal/crawl/config/crawler/cronjob/cronjob.yaml rename to hacks/crawl/config/crawler/cronjob/cronjob.yaml diff --git a/internal/crawl/config/crawler/cronjob/kustomization.yaml b/hacks/crawl/config/crawler/cronjob/kustomization.yaml similarity index 100% rename from internal/crawl/config/crawler/cronjob/kustomization.yaml rename to hacks/crawl/config/crawler/cronjob/kustomization.yaml diff --git a/internal/crawl/config/crawler/job/job.yaml b/hacks/crawl/config/crawler/job/job.yaml similarity index 100% rename from internal/crawl/config/crawler/job/job.yaml rename to hacks/crawl/config/crawler/job/job.yaml diff --git a/internal/crawl/config/crawler/job/kustomization.yaml b/hacks/crawl/config/crawler/job/kustomization.yaml similarity index 100% rename from internal/crawl/config/crawler/job/kustomization.yaml rename to hacks/crawl/config/crawler/job/kustomization.yaml diff --git a/internal/crawl/config/redis/document_keystore/kustomization.yaml b/hacks/crawl/config/redis/document_keystore/kustomization.yaml similarity index 100% rename from internal/crawl/config/redis/document_keystore/kustomization.yaml rename to hacks/crawl/config/redis/document_keystore/kustomization.yaml diff --git a/internal/crawl/config/redis/document_keystore/redis.yaml b/hacks/crawl/config/redis/document_keystore/redis.yaml similarity index 100% rename from internal/crawl/config/redis/document_keystore/redis.yaml rename to hacks/crawl/config/redis/document_keystore/redis.yaml diff --git a/internal/crawl/config/redis/document_keystore/service.yaml b/hacks/crawl/config/redis/document_keystore/service.yaml similarity index 100% rename from internal/crawl/config/redis/document_keystore/service.yaml rename to hacks/crawl/config/redis/document_keystore/service.yaml diff --git a/internal/crawl/config/redis/http_cache/kustomization.yaml b/hacks/crawl/config/redis/http_cache/kustomization.yaml similarity index 100% rename from internal/crawl/config/redis/http_cache/kustomization.yaml rename to hacks/crawl/config/redis/http_cache/kustomization.yaml diff --git a/internal/crawl/config/redis/http_cache/redis.yaml b/hacks/crawl/config/redis/http_cache/redis.yaml similarity index 100% rename from internal/crawl/config/redis/http_cache/redis.yaml rename to hacks/crawl/config/redis/http_cache/redis.yaml diff --git a/internal/crawl/config/redis/http_cache/service.yaml b/hacks/crawl/config/redis/http_cache/service.yaml similarity index 100% rename from internal/crawl/config/redis/http_cache/service.yaml rename to hacks/crawl/config/redis/http_cache/service.yaml diff --git a/internal/crawl/config/webapp/backend/deployment.yaml b/hacks/crawl/config/webapp/backend/deployment.yaml similarity index 100% rename from internal/crawl/config/webapp/backend/deployment.yaml rename to hacks/crawl/config/webapp/backend/deployment.yaml diff --git a/internal/crawl/config/webapp/backend/kustomization.yaml b/hacks/crawl/config/webapp/backend/kustomization.yaml similarity index 100% rename from internal/crawl/config/webapp/backend/kustomization.yaml rename to hacks/crawl/config/webapp/backend/kustomization.yaml diff --git a/internal/crawl/config/webapp/backend/service.yaml b/hacks/crawl/config/webapp/backend/service.yaml similarity index 100% rename from internal/crawl/config/webapp/backend/service.yaml rename to hacks/crawl/config/webapp/backend/service.yaml diff --git a/internal/crawl/config/webapp/frontend/deployment.yaml b/hacks/crawl/config/webapp/frontend/deployment.yaml similarity index 100% rename from internal/crawl/config/webapp/frontend/deployment.yaml rename to hacks/crawl/config/webapp/frontend/deployment.yaml diff --git a/internal/crawl/config/webapp/frontend/kustomization.yaml b/hacks/crawl/config/webapp/frontend/kustomization.yaml similarity index 100% rename from internal/crawl/config/webapp/frontend/kustomization.yaml rename to hacks/crawl/config/webapp/frontend/kustomization.yaml diff --git a/internal/crawl/config/webapp/frontend/service.yaml b/hacks/crawl/config/webapp/frontend/service.yaml similarity index 100% rename from internal/crawl/config/webapp/frontend/service.yaml rename to hacks/crawl/config/webapp/frontend/service.yaml diff --git a/internal/crawl/crawler/crawler.go b/hacks/crawl/crawler/crawler.go similarity index 100% rename from internal/crawl/crawler/crawler.go rename to hacks/crawl/crawler/crawler.go diff --git a/internal/crawl/crawler/crawler_test.go b/hacks/crawl/crawler/crawler_test.go similarity index 99% rename from internal/crawl/crawler/crawler_test.go rename to hacks/crawl/crawler/crawler_test.go index 762b67bde..366aea632 100644 --- a/internal/crawl/crawler/crawler_test.go +++ b/hacks/crawl/crawler/crawler_test.go @@ -339,7 +339,7 @@ resources: }, nil }, func(d CrawledDocument, cr Crawler) error { - visited[d.ID()]++ + visited[ID()]++ return nil }, ) diff --git a/internal/crawl/crawler/github/crawler.go b/hacks/crawl/crawler/github/crawler.go similarity index 99% rename from internal/crawl/crawler/github/crawler.go rename to hacks/crawl/crawler/github/crawler.go index 84d7f737d..400c416dc 100644 --- a/internal/crawl/crawler/github/crawler.go +++ b/hacks/crawl/crawler/github/crawler.go @@ -122,7 +122,7 @@ func (gc githubCrawler) FetchDocument(ctx context.Context, d *doc.Document) erro return nil } - for _, file := range pgmconfig.KustomizationFileNames { + for _, file := range pgmconfig.RecognizedKustomizationFileNames() { resp, err = gc.client.GetRawUserContent(url + "/" + file) err := handle(resp, err, "/"+file) if err != nil { diff --git a/internal/crawl/crawler/github/queries.go b/hacks/crawl/crawler/github/queries.go similarity index 100% rename from internal/crawl/crawler/github/queries.go rename to hacks/crawl/crawler/github/queries.go diff --git a/internal/crawl/crawler/github/queries_test.go b/hacks/crawl/crawler/github/queries_test.go similarity index 100% rename from internal/crawl/crawler/github/queries_test.go rename to hacks/crawl/crawler/github/queries_test.go diff --git a/internal/crawl/crawler/github/split_search_ranges.go b/hacks/crawl/crawler/github/split_search_ranges.go similarity index 100% rename from internal/crawl/crawler/github/split_search_ranges.go rename to hacks/crawl/crawler/github/split_search_ranges.go diff --git a/internal/crawl/crawler/github/split_search_ranges_test.go b/hacks/crawl/crawler/github/split_search_ranges_test.go similarity index 98% rename from internal/crawl/crawler/github/split_search_ranges_test.go rename to hacks/crawl/crawler/github/split_search_ranges_test.go index c175486e6..3102145e2 100644 --- a/internal/crawl/crawler/github/split_search_ranges_test.go +++ b/hacks/crawl/crawler/github/split_search_ranges_test.go @@ -20,7 +20,7 @@ func (c testCachedSearch) CountResults(upperBound uint64) (uint64, error) { } func (c testCachedSearch) RequestString(filesize rangeFormatter) string { - return filesize.RangeString() + return RangeString() } // TODO(damienr74) make tests easier to write.. I'm thinking I can make the test diff --git a/internal/crawl/doc/doc.go b/hacks/crawl/doc/doc.go similarity index 97% rename from internal/crawl/doc/doc.go rename to hacks/crawl/doc/doc.go index cc1146c3f..44e1ac567 100644 --- a/internal/crawl/doc/doc.go +++ b/hacks/crawl/doc/doc.go @@ -47,7 +47,7 @@ type set map[string]struct{} // Implements the CrawlerDocument interface. func (doc *KustomizationDocument) GetResources() ([]*Document, error) { isResource := true - for _, suffix := range pgmconfig.KustomizationFileNames { + for _, suffix := range pgmconfig.RecognizedKustomizationFileNames() { if strings.HasSuffix(doc.FilePath, "/"+suffix) { isResource = false } @@ -86,7 +86,7 @@ func (doc *KustomizationDocument) GetResources() ([]*Document, error) { func (doc *KustomizationDocument) readBytes() ([]map[string]interface{}, error) { data := []byte(doc.DocumentData) - for _, suffix := range pgmconfig.KustomizationFileNames { + for _, suffix := range pgmconfig.RecognizedKustomizationFileNames() { if !strings.HasSuffix(doc.FilePath, "/"+suffix) { continue } diff --git a/internal/crawl/doc/doc_test.go b/hacks/crawl/doc/doc_test.go similarity index 100% rename from internal/crawl/doc/doc_test.go rename to hacks/crawl/doc/doc_test.go diff --git a/internal/crawl/doc/docname.go b/hacks/crawl/doc/docname.go similarity index 96% rename from internal/crawl/doc/docname.go rename to hacks/crawl/doc/docname.go index a7e75fd53..a5fa65113 100644 --- a/internal/crawl/doc/docname.go +++ b/hacks/crawl/doc/docname.go @@ -4,7 +4,7 @@ import ( "path" "time" - "sigs.k8s.io/kustomize/v3/api/internal/git" + "sigs.k8s.io/kustomize/v3/api/git" ) type Document struct { diff --git a/internal/crawl/doc/docname_test.go b/hacks/crawl/doc/docname_test.go similarity index 100% rename from internal/crawl/doc/docname_test.go rename to hacks/crawl/doc/docname_test.go diff --git a/internal/crawl/doc/kustomize_util.go b/hacks/crawl/doc/kustomize_util.go similarity index 100% rename from internal/crawl/doc/kustomize_util.go rename to hacks/crawl/doc/kustomize_util.go diff --git a/internal/crawl/go.mod b/hacks/crawl/go.mod similarity index 100% rename from internal/crawl/go.mod rename to hacks/crawl/go.mod diff --git a/internal/crawl/go.sum b/hacks/crawl/go.sum similarity index 100% rename from internal/crawl/go.sum rename to hacks/crawl/go.sum diff --git a/internal/crawl/httpclient/httpclient.go b/hacks/crawl/httpclient/httpclient.go similarity index 100% rename from internal/crawl/httpclient/httpclient.go rename to hacks/crawl/httpclient/httpclient.go diff --git a/internal/crawl/index/elasticsearch.go b/hacks/crawl/index/elasticsearch.go similarity index 100% rename from internal/crawl/index/elasticsearch.go rename to hacks/crawl/index/elasticsearch.go diff --git a/internal/crawl/index/kustomize.go b/hacks/crawl/index/kustomize.go similarity index 100% rename from internal/crawl/index/kustomize.go rename to hacks/crawl/index/kustomize.go diff --git a/internal/crawl/index/kustomize_test.go b/hacks/crawl/index/kustomize_test.go similarity index 100% rename from internal/crawl/index/kustomize_test.go rename to hacks/crawl/index/kustomize_test.go diff --git a/internal/crawl/pictures/github_token.png b/hacks/crawl/pictures/github_token.png similarity index 100% rename from internal/crawl/pictures/github_token.png rename to hacks/crawl/pictures/github_token.png diff --git a/internal/crawl/pictures/sys_arch.png b/hacks/crawl/pictures/sys_arch.png similarity index 100% rename from internal/crawl/pictures/sys_arch.png rename to hacks/crawl/pictures/sys_arch.png diff --git a/internal/crawl/pictures/token_config.png b/hacks/crawl/pictures/token_config.png similarity index 100% rename from internal/crawl/pictures/token_config.png rename to hacks/crawl/pictures/token_config.png diff --git a/internal/crawl/ui/.dockerignore b/hacks/crawl/ui/.dockerignore similarity index 100% rename from internal/crawl/ui/.dockerignore rename to hacks/crawl/ui/.dockerignore diff --git a/internal/crawl/ui/.gcloudignore b/hacks/crawl/ui/.gcloudignore similarity index 100% rename from internal/crawl/ui/.gcloudignore rename to hacks/crawl/ui/.gcloudignore diff --git a/internal/crawl/ui/.gitignore b/hacks/crawl/ui/.gitignore similarity index 100% rename from internal/crawl/ui/.gitignore rename to hacks/crawl/ui/.gitignore diff --git a/internal/crawl/ui/Dockerfile b/hacks/crawl/ui/Dockerfile similarity index 100% rename from internal/crawl/ui/Dockerfile rename to hacks/crawl/ui/Dockerfile diff --git a/internal/crawl/ui/README.md b/hacks/crawl/ui/README.md similarity index 100% rename from internal/crawl/ui/README.md rename to hacks/crawl/ui/README.md diff --git a/internal/crawl/ui/angular.json b/hacks/crawl/ui/angular.json similarity index 100% rename from internal/crawl/ui/angular.json rename to hacks/crawl/ui/angular.json diff --git a/internal/crawl/ui/browserslist b/hacks/crawl/ui/browserslist similarity index 100% rename from internal/crawl/ui/browserslist rename to hacks/crawl/ui/browserslist diff --git a/internal/crawl/ui/cloudbuild.yaml b/hacks/crawl/ui/cloudbuild.yaml similarity index 100% rename from internal/crawl/ui/cloudbuild.yaml rename to hacks/crawl/ui/cloudbuild.yaml diff --git a/internal/crawl/ui/e2e/protractor.conf.js b/hacks/crawl/ui/e2e/protractor.conf.js similarity index 100% rename from internal/crawl/ui/e2e/protractor.conf.js rename to hacks/crawl/ui/e2e/protractor.conf.js diff --git a/internal/crawl/ui/e2e/src/app.e2e-spec.ts b/hacks/crawl/ui/e2e/src/app.e2e-spec.ts similarity index 100% rename from internal/crawl/ui/e2e/src/app.e2e-spec.ts rename to hacks/crawl/ui/e2e/src/app.e2e-spec.ts diff --git a/internal/crawl/ui/e2e/src/app.po.ts b/hacks/crawl/ui/e2e/src/app.po.ts similarity index 100% rename from internal/crawl/ui/e2e/src/app.po.ts rename to hacks/crawl/ui/e2e/src/app.po.ts diff --git a/internal/crawl/ui/e2e/tsconfig.json b/hacks/crawl/ui/e2e/tsconfig.json similarity index 100% rename from internal/crawl/ui/e2e/tsconfig.json rename to hacks/crawl/ui/e2e/tsconfig.json diff --git a/internal/crawl/ui/karma.conf.js b/hacks/crawl/ui/karma.conf.js similarity index 100% rename from internal/crawl/ui/karma.conf.js rename to hacks/crawl/ui/karma.conf.js diff --git a/internal/crawl/ui/nginx.conf b/hacks/crawl/ui/nginx.conf similarity index 100% rename from internal/crawl/ui/nginx.conf rename to hacks/crawl/ui/nginx.conf diff --git a/internal/crawl/ui/package-lock.json b/hacks/crawl/ui/package-lock.json similarity index 100% rename from internal/crawl/ui/package-lock.json rename to hacks/crawl/ui/package-lock.json diff --git a/internal/crawl/ui/package.json b/hacks/crawl/ui/package.json similarity index 100% rename from internal/crawl/ui/package.json rename to hacks/crawl/ui/package.json diff --git a/internal/crawl/ui/src/app/app.component.css b/hacks/crawl/ui/src/app/app.component.css similarity index 100% rename from internal/crawl/ui/src/app/app.component.css rename to hacks/crawl/ui/src/app/app.component.css diff --git a/internal/crawl/ui/src/app/app.component.html b/hacks/crawl/ui/src/app/app.component.html similarity index 100% rename from internal/crawl/ui/src/app/app.component.html rename to hacks/crawl/ui/src/app/app.component.html diff --git a/internal/crawl/ui/src/app/app.component.spec.ts b/hacks/crawl/ui/src/app/app.component.spec.ts similarity index 100% rename from internal/crawl/ui/src/app/app.component.spec.ts rename to hacks/crawl/ui/src/app/app.component.spec.ts diff --git a/internal/crawl/ui/src/app/app.component.ts b/hacks/crawl/ui/src/app/app.component.ts similarity index 100% rename from internal/crawl/ui/src/app/app.component.ts rename to hacks/crawl/ui/src/app/app.component.ts diff --git a/internal/crawl/ui/src/app/app.module.ts b/hacks/crawl/ui/src/app/app.module.ts similarity index 100% rename from internal/crawl/ui/src/app/app.module.ts rename to hacks/crawl/ui/src/app/app.module.ts diff --git a/internal/crawl/ui/src/app/documents.ts b/hacks/crawl/ui/src/app/documents.ts similarity index 100% rename from internal/crawl/ui/src/app/documents.ts rename to hacks/crawl/ui/src/app/documents.ts diff --git a/internal/crawl/ui/src/app/histogram/histogram.component.css b/hacks/crawl/ui/src/app/histogram/histogram.component.css similarity index 100% rename from internal/crawl/ui/src/app/histogram/histogram.component.css rename to hacks/crawl/ui/src/app/histogram/histogram.component.css diff --git a/internal/crawl/ui/src/app/histogram/histogram.component.html b/hacks/crawl/ui/src/app/histogram/histogram.component.html similarity index 100% rename from internal/crawl/ui/src/app/histogram/histogram.component.html rename to hacks/crawl/ui/src/app/histogram/histogram.component.html diff --git a/internal/crawl/ui/src/app/histogram/histogram.component.spec.ts b/hacks/crawl/ui/src/app/histogram/histogram.component.spec.ts similarity index 100% rename from internal/crawl/ui/src/app/histogram/histogram.component.spec.ts rename to hacks/crawl/ui/src/app/histogram/histogram.component.spec.ts diff --git a/internal/crawl/ui/src/app/histogram/histogram.component.ts b/hacks/crawl/ui/src/app/histogram/histogram.component.ts similarity index 100% rename from internal/crawl/ui/src/app/histogram/histogram.component.ts rename to hacks/crawl/ui/src/app/histogram/histogram.component.ts diff --git a/internal/crawl/ui/src/app/search/search.component.css b/hacks/crawl/ui/src/app/search/search.component.css similarity index 100% rename from internal/crawl/ui/src/app/search/search.component.css rename to hacks/crawl/ui/src/app/search/search.component.css diff --git a/internal/crawl/ui/src/app/search/search.component.html b/hacks/crawl/ui/src/app/search/search.component.html similarity index 100% rename from internal/crawl/ui/src/app/search/search.component.html rename to hacks/crawl/ui/src/app/search/search.component.html diff --git a/internal/crawl/ui/src/app/search/search.component.spec.ts b/hacks/crawl/ui/src/app/search/search.component.spec.ts similarity index 100% rename from internal/crawl/ui/src/app/search/search.component.spec.ts rename to hacks/crawl/ui/src/app/search/search.component.spec.ts diff --git a/internal/crawl/ui/src/app/search/search.component.ts b/hacks/crawl/ui/src/app/search/search.component.ts similarity index 100% rename from internal/crawl/ui/src/app/search/search.component.ts rename to hacks/crawl/ui/src/app/search/search.component.ts diff --git a/internal/crawl/ui/src/app/search/search.service.ts b/hacks/crawl/ui/src/app/search/search.service.ts similarity index 100% rename from internal/crawl/ui/src/app/search/search.service.ts rename to hacks/crawl/ui/src/app/search/search.service.ts diff --git a/internal/crawl/ui/src/app/timeseries/timeseries.component.css b/hacks/crawl/ui/src/app/timeseries/timeseries.component.css similarity index 100% rename from internal/crawl/ui/src/app/timeseries/timeseries.component.css rename to hacks/crawl/ui/src/app/timeseries/timeseries.component.css diff --git a/internal/crawl/ui/src/app/timeseries/timeseries.component.html b/hacks/crawl/ui/src/app/timeseries/timeseries.component.html similarity index 100% rename from internal/crawl/ui/src/app/timeseries/timeseries.component.html rename to hacks/crawl/ui/src/app/timeseries/timeseries.component.html diff --git a/internal/crawl/ui/src/app/timeseries/timeseries.component.spec.ts b/hacks/crawl/ui/src/app/timeseries/timeseries.component.spec.ts similarity index 100% rename from internal/crawl/ui/src/app/timeseries/timeseries.component.spec.ts rename to hacks/crawl/ui/src/app/timeseries/timeseries.component.spec.ts diff --git a/internal/crawl/ui/src/app/timeseries/timeseries.component.ts b/hacks/crawl/ui/src/app/timeseries/timeseries.component.ts similarity index 100% rename from internal/crawl/ui/src/app/timeseries/timeseries.component.ts rename to hacks/crawl/ui/src/app/timeseries/timeseries.component.ts diff --git a/internal/crawl/ui/src/assets/.gitkeep b/hacks/crawl/ui/src/assets/.gitkeep similarity index 100% rename from internal/crawl/ui/src/assets/.gitkeep rename to hacks/crawl/ui/src/assets/.gitkeep diff --git a/internal/crawl/ui/src/environments/environment.prod.ts b/hacks/crawl/ui/src/environments/environment.prod.ts similarity index 100% rename from internal/crawl/ui/src/environments/environment.prod.ts rename to hacks/crawl/ui/src/environments/environment.prod.ts diff --git a/internal/crawl/ui/src/environments/environment.ts b/hacks/crawl/ui/src/environments/environment.ts similarity index 100% rename from internal/crawl/ui/src/environments/environment.ts rename to hacks/crawl/ui/src/environments/environment.ts diff --git a/internal/crawl/ui/src/favicon.ico b/hacks/crawl/ui/src/favicon.ico similarity index 100% rename from internal/crawl/ui/src/favicon.ico rename to hacks/crawl/ui/src/favicon.ico diff --git a/internal/crawl/ui/src/index.html b/hacks/crawl/ui/src/index.html similarity index 100% rename from internal/crawl/ui/src/index.html rename to hacks/crawl/ui/src/index.html diff --git a/internal/crawl/ui/src/main.ts b/hacks/crawl/ui/src/main.ts similarity index 100% rename from internal/crawl/ui/src/main.ts rename to hacks/crawl/ui/src/main.ts diff --git a/internal/crawl/ui/src/polyfills.ts b/hacks/crawl/ui/src/polyfills.ts similarity index 100% rename from internal/crawl/ui/src/polyfills.ts rename to hacks/crawl/ui/src/polyfills.ts diff --git a/internal/crawl/ui/src/styles.css b/hacks/crawl/ui/src/styles.css similarity index 100% rename from internal/crawl/ui/src/styles.css rename to hacks/crawl/ui/src/styles.css diff --git a/internal/crawl/ui/src/test.ts b/hacks/crawl/ui/src/test.ts similarity index 100% rename from internal/crawl/ui/src/test.ts rename to hacks/crawl/ui/src/test.ts diff --git a/internal/crawl/ui/tsconfig.app.json b/hacks/crawl/ui/tsconfig.app.json similarity index 100% rename from internal/crawl/ui/tsconfig.app.json rename to hacks/crawl/ui/tsconfig.app.json diff --git a/internal/crawl/ui/tsconfig.json b/hacks/crawl/ui/tsconfig.json similarity index 100% rename from internal/crawl/ui/tsconfig.json rename to hacks/crawl/ui/tsconfig.json diff --git a/internal/crawl/ui/tsconfig.spec.json b/hacks/crawl/ui/tsconfig.spec.json similarity index 100% rename from internal/crawl/ui/tsconfig.spec.json rename to hacks/crawl/ui/tsconfig.spec.json diff --git a/internal/crawl/ui/tslint.json b/hacks/crawl/ui/tslint.json similarity index 100% rename from internal/crawl/ui/tslint.json rename to hacks/crawl/ui/tslint.json diff --git a/hacks/imports.sh b/hacks/imports.sh index 29dbeaa5a..a9b834246 100755 --- a/hacks/imports.sh +++ b/hacks/imports.sh @@ -1,4 +1,5 @@ for f in $(find ./ -name '*.go'); do echo $f + # go run go.coder.com/go-tools/cmd/goimports ~/gopath/bin/goimports -w $f done diff --git a/internal/kusterr/configmaperror.go b/internal/kusterr/configmaperror.go deleted file mode 100644 index af1264dc7..000000000 --- a/internal/kusterr/configmaperror.go +++ /dev/null @@ -1,30 +0,0 @@ -/* -Copyright 2018 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Package error has contextual error types. -package kusterr - -import "fmt" - -// ConfigmapError represents error with a configmap. -type ConfigmapError struct { - Path string - ErrorMsg string -} - -func (e ConfigmapError) Error() string { - return fmt.Sprintf("Kustomization file [%s] encounters a configmap error: %s\n", e.Path, e.ErrorMsg) -} diff --git a/internal/kusterr/configmaperror_test.go b/internal/kusterr/configmaperror_test.go deleted file mode 100644 index d0a3a70fc..000000000 --- a/internal/kusterr/configmaperror_test.go +++ /dev/null @@ -1,37 +0,0 @@ -/* -Copyright 2018 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package kusterr - -import ( - "strings" - "testing" -) - -func TestConfigmapError_Error(t *testing.T) { - errorMsg := "configmap name is missing" - me := ConfigmapError{Path: filepath, ErrorMsg: errorMsg} - - if !strings.Contains(me.Error(), filepath) { - t.Errorf("Incorrect ConfigmapError.Error() message \n") - t.Errorf("Expected filepath %s, but unfound\n", filepath) - } - - if !strings.Contains(me.Error(), errorMsg) { - t.Errorf("Incorrect ConfigmapError.Error() message \n") - t.Errorf("Expected errorMsg %s, but unfound\n", errorMsg) - } -} diff --git a/internal/kusterr/patcherror.go b/internal/kusterr/patcherror.go deleted file mode 100644 index b110e6085..000000000 --- a/internal/kusterr/patcherror.go +++ /dev/null @@ -1,32 +0,0 @@ -/* -Copyright 2018 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package kusterr - -import ( - "fmt" -) - -// PatchError represents error during Patch. -type PatchError struct { - KustomizationPath string - PatchFilepath string - ErrorMsg string -} - -func (e PatchError) Error() string { - return fmt.Sprintf("Kustomization file [%s] encounters a patch error for [%s]: %s\n", e.KustomizationPath, e.PatchFilepath, e.ErrorMsg) -} diff --git a/internal/kusterr/patcherror_test.go b/internal/kusterr/patcherror_test.go deleted file mode 100644 index f5129eb7e..000000000 --- a/internal/kusterr/patcherror_test.go +++ /dev/null @@ -1,40 +0,0 @@ -/* -Copyright 2018 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package kusterr - -import ( - "strings" - "testing" -) - -func TestPatchError_Error(t *testing.T) { - patchfilepath := "/path/to/patch/patch.yaml" - errorMsg := "file not found" - me := PatchError{KustomizationPath: filepath, PatchFilepath: patchfilepath, ErrorMsg: errorMsg} - if !strings.Contains(me.Error(), filepath) { - t.Errorf("Incorrect PatchError.Error() message \n") - t.Errorf("Expected filepath %s, but unfound\n", filepath) - } - if !strings.Contains(me.Error(), patchfilepath) { - t.Errorf("Incorrect PatchError.Error() message \n") - t.Errorf("Expected patchfilepath %s, but unfound\n", patchfilepath) - } - if !strings.Contains(me.Error(), errorMsg) { - t.Errorf("Incorrect PatchError.Error() message \n") - t.Errorf("Expected errorMsg %s, but unfound\n", errorMsg) - } -} diff --git a/internal/kusterr/resourceerror.go b/internal/kusterr/resourceerror.go deleted file mode 100644 index 8701c9753..000000000 --- a/internal/kusterr/resourceerror.go +++ /dev/null @@ -1,30 +0,0 @@ -/* -Copyright 2018 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package kusterr - -import "fmt" - -// ResourceError represents error in a resource. -type ResourceError struct { - KustomizationPath string - ResourceFilepath string - ErrorMsg string -} - -func (e ResourceError) Error() string { - return fmt.Sprintf("Kustomization file [%s] encounters a resource error for [%s]: %s\n", e.KustomizationPath, e.ResourceFilepath, e.ErrorMsg) -} diff --git a/internal/kusterr/resourceerror_test.go b/internal/kusterr/resourceerror_test.go deleted file mode 100644 index 62adbd487..000000000 --- a/internal/kusterr/resourceerror_test.go +++ /dev/null @@ -1,40 +0,0 @@ -/* -Copyright 2018 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package kusterr - -import ( - "strings" - "testing" -) - -func TestResourceError_Error(t *testing.T) { - resourcefilepath := "/path/to/resource/deployment.yaml" - errorMsg := "file not found" - me := ResourceError{KustomizationPath: filepath, ResourceFilepath: resourcefilepath, ErrorMsg: errorMsg} - if !strings.Contains(me.Error(), filepath) { - t.Errorf("Incorrect ResourceError.Error() message \n") - t.Errorf("Expected filepath %s, but unfound\n", filepath) - } - if !strings.Contains(me.Error(), resourcefilepath) { - t.Errorf("Incorrect ResourceError.Error() message \n") - t.Errorf("Expected resourcefilepath %s, but unfound\n", resourcefilepath) - } - if !strings.Contains(me.Error(), errorMsg) { - t.Errorf("Incorrect ResourceError.Error() message \n") - t.Errorf("Expected errorMsg %s, but unfound\n", errorMsg) - } -} diff --git a/internal/kusterr/secreterror.go b/internal/kusterr/secreterror.go deleted file mode 100644 index edf0be96d..000000000 --- a/internal/kusterr/secreterror.go +++ /dev/null @@ -1,30 +0,0 @@ -/* -Copyright 2018 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package kusterr - -import "fmt" - -// SecretError represents error with a secret. -type SecretError struct { - KustomizationPath string - // ErrorMsg is an error message - ErrorMsg string -} - -func (e SecretError) Error() string { - return fmt.Sprintf("Kustomization file [%s] encounters a secret error: %s\n", e.KustomizationPath, e.ErrorMsg) -} diff --git a/internal/kusterr/secreterror_test.go b/internal/kusterr/secreterror_test.go deleted file mode 100644 index 05d9f279c..000000000 --- a/internal/kusterr/secreterror_test.go +++ /dev/null @@ -1,36 +0,0 @@ -/* -Copyright 2018 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package kusterr - -import ( - "strings" - "testing" -) - -func TestSecretError_Error(t *testing.T) { - errorMsg := "missing a command" - me := SecretError{KustomizationPath: filepath, ErrorMsg: errorMsg} - if !strings.Contains(me.Error(), filepath) { - t.Errorf("Incorrect SecretError.Error() message \n") - t.Errorf("Expected filepath %s, but unfound\n", filepath) - } - - if !strings.Contains(me.Error(), errorMsg) { - t.Errorf("Incorrect SecretError.Error() message \n") - t.Errorf("Expected errorMsg %s, but unfound\n", errorMsg) - } -}