evaluate equality on clone - do not sort original - fixes #84
This commit is contained in:
@@ -6,8 +6,12 @@ fmt:
|
||||
tidy:
|
||||
go mod tidy
|
||||
|
||||
generate: deepcopy-gen
|
||||
touch ./tmp/deepcopy-gen-boilerplate.go.txt
|
||||
deepcopy-gen -h ./tmp/deepcopy-gen-boilerplate.go.txt -i ./pkg/types
|
||||
|
||||
# Run tests
|
||||
test: test-ci fmt
|
||||
test: generate test-ci fmt
|
||||
|
||||
# Run ci tests
|
||||
test-ci: mocks tidy
|
||||
@@ -35,6 +39,11 @@ ifeq (, $(shell which mockgen))
|
||||
$(shell go install github.com/golang/mock/mockgen@v1.6.0)
|
||||
endif
|
||||
|
||||
deepcopy-gen:
|
||||
ifeq (, $(shell which deepcopy-gen))
|
||||
$(shell go install k8s.io/code-generator/cmd/deepcopy-gen@latest)
|
||||
endif
|
||||
|
||||
start-replica:
|
||||
podman run --pull always --rm -it -p 9090:80 -p 9091:3000 adguard/adguardhome
|
||||
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
//go:build !ignore_autogenerated
|
||||
// +build !ignore_autogenerated
|
||||
|
||||
// Code generated by deepcopy-gen. DO NOT EDIT.
|
||||
|
||||
package types
|
||||
|
||||
import (
|
||||
net "net"
|
||||
)
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *DNSConfig) DeepCopyInto(out *DNSConfig) {
|
||||
*out = *in
|
||||
if in.Upstreams != nil {
|
||||
in, out := &in.Upstreams, &out.Upstreams
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.Bootstraps != nil {
|
||||
in, out := &in.Bootstraps, &out.Bootstraps
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.BlockingIPv4 != nil {
|
||||
in, out := &in.BlockingIPv4, &out.BlockingIPv4
|
||||
*out = make(net.IP, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.BlockingIPv6 != nil {
|
||||
in, out := &in.BlockingIPv6, &out.BlockingIPv6
|
||||
*out = make(net.IP, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.LocalPTRUpstreams != nil {
|
||||
in, out := &in.LocalPTRUpstreams, &out.LocalPTRUpstreams
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DNSConfig.
|
||||
func (in *DNSConfig) DeepCopy() *DNSConfig {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(DNSConfig)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
+7
-4
@@ -7,6 +7,7 @@ import (
|
||||
)
|
||||
|
||||
// DNSConfig dns config
|
||||
// +k8s:deepcopy-gen=true
|
||||
type DNSConfig struct {
|
||||
Upstreams []string `json:"upstream_dns,omitempty"`
|
||||
UpstreamsFile string `json:"upstream_dns_file"`
|
||||
@@ -31,11 +32,13 @@ type DNSConfig struct {
|
||||
|
||||
// Equals dns config equal check
|
||||
func (c *DNSConfig) Equals(o *DNSConfig) bool {
|
||||
c.Sort()
|
||||
o.Sort()
|
||||
cc := c.DeepCopy()
|
||||
oo := o.DeepCopy()
|
||||
cc.Sort()
|
||||
oo.Sort()
|
||||
|
||||
a, _ := json.Marshal(c)
|
||||
b, _ := json.Marshal(o)
|
||||
a, _ := json.Marshal(cc)
|
||||
b, _ := json.Marshal(oo)
|
||||
return string(a) == string(b)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user