Skip to content

Commit 69179b5

Browse files
committed
Moved the init of scheme to main
Signed-off-by: Shiming Zhang <[email protected]>
1 parent ea47086 commit 69179b5

File tree

8 files changed

+74
-6
lines changed

8 files changed

+74
-6
lines changed

Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ clean:
5757

5858
generate:
5959
go mod vendor
60-
rm ./pkg/encoding/scheme.go
61-
./hack/gen_scheme.sh > pkg/encoding/scheme.go
60+
rm ./pkg/scheme/scheme.go
61+
./hack/gen_scheme.sh > pkg/scheme/scheme.go
6262

6363
.PHONY: build test release release-docker-build clean generate

cmd/init_test.go

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
Copyright 2024 The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package cmd
18+
19+
import (
20+
_ "github.com/etcd-io/auger/pkg/scheme"
21+
)

hack/gen_scheme.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ See the License for the specific language governing permissions and
3838
limitations under the License.
3939
*/
4040
41-
package encoding
41+
package scheme
4242
4343
// Don't edit this file directly. It is generated by scheme.sh.
4444
import (

main.go

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ import (
1919
"fmt"
2020
"os"
2121

22+
_ "github.com/etcd-io/auger/pkg/scheme"
23+
2224
"github.com/etcd-io/auger/cmd"
2325
)
2426

pkg/data/init_test.go

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
Copyright 2024 The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package data
18+
19+
import (
20+
_ "github.com/etcd-io/auger/pkg/scheme"
21+
)

pkg/encoding/init.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ package encoding
1919
import (
2020
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2121
runtime "k8s.io/apimachinery/pkg/runtime"
22-
schema "k8s.io/apimachinery/pkg/runtime/schema"
22+
"k8s.io/apimachinery/pkg/runtime/schema"
2323
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
2424
)
2525

@@ -28,5 +28,4 @@ var Codecs = serializer.NewCodecFactory(Scheme)
2828

2929
func init() {
3030
v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"})
31-
AddToScheme(Scheme)
3231
}

pkg/scheme/init.go

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
Copyright The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package scheme
18+
19+
import (
20+
"github.com/etcd-io/auger/pkg/encoding"
21+
)
22+
23+
func init() {
24+
AddToScheme(encoding.Scheme)
25+
}

pkg/encoding/scheme.go pkg/scheme/scheme.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
package encoding
17+
package scheme
1818

1919
// Don't edit this file directly. It is generated by scheme.sh.
2020
import (

0 commit comments

Comments
 (0)