diff --git a/internal/ipset/ipset_linux.go b/internal/ipset/ipset_linux.go index 067580608c6..4cf1fe12736 100644 --- a/internal/ipset/ipset_linux.go +++ b/internal/ipset/ipset_linux.go @@ -298,6 +298,8 @@ func (m *manager) parseIpsetConfig(ipsetConf []string) (err error) { // ipsetProps returns the properties of an ipset with the given name. // // Additional header data query. See https://github.com/AdguardTeam/AdGuardHome/issues/6420. +// +// TODO(s.chzhen): Use *props. func (m *manager) ipsetProps(name string) (p props, err error) { // The family doesn't seem to matter when we use a header query, so // query only the IPv4 one. @@ -328,7 +330,8 @@ func (m *manager) ipsetProps(name string) (p props, err error) { }, nil } -// ipsets returns currently known ipsets. +// ipsets returns ipset properties of currently known ipsets. It also makes an +// additional ipset header data query if needed. func (m *manager) ipsets(names []string, currentlyKnown map[string]props) (sets []props, err error) { for _, n := range names { p, ok := currentlyKnown[n] diff --git a/internal/schedule/schedule.go b/internal/schedule/schedule.go index fe5aeb82f40..8335a79e3f6 100644 --- a/internal/schedule/schedule.go +++ b/internal/schedule/schedule.go @@ -339,9 +339,6 @@ func (r dayRange) toDayConfigJSON() (j *dayConfigJSON) { // weeklyConfigJSON is the JSON configuration structure of Weekly. type weeklyConfigJSON struct { - // TimeZone is the local time zone. - TimeZone string `json:"time_zone"` - // Days of the week. Sunday *dayConfigJSON `json:"sun,omitempty"` @@ -351,6 +348,9 @@ type weeklyConfigJSON struct { Thursday *dayConfigJSON `json:"thu,omitempty"` Friday *dayConfigJSON `json:"fri,omitempty"` Saturday *dayConfigJSON `json:"sat,omitempty"` + + // TimeZone is the local time zone. + TimeZone string `json:"time_zone"` } // dayConfigJSON is the JSON configuration structure of dayRange. diff --git a/internal/schedule/schedule_internal_test.go b/internal/schedule/schedule_internal_test.go index 0d9aa705f5b..3e95676c279 100644 --- a/internal/schedule/schedule_internal_test.go +++ b/internal/schedule/schedule_internal_test.go @@ -163,10 +163,10 @@ yaml: "bad" } testCases := []struct { + want *Weekly name string wantErrMsg string data []byte - want *Weekly }{{ name: "empty", wantErrMsg: "", @@ -228,9 +228,9 @@ func TestWeekly_MarshalYAML(t *testing.T) { } testCases := []struct { + want *Weekly name string data []byte - want *Weekly }{{ name: "empty", data: []byte(""), @@ -263,8 +263,8 @@ func TestWeekly_MarshalYAML(t *testing.T) { func TestWeekly_Validate(t *testing.T) { testCases := []struct { name string - in dayRange wantErrMsg string + in dayRange }{{ name: "empty", wantErrMsg: "", @@ -298,8 +298,8 @@ func TestWeekly_Validate(t *testing.T) { func TestDayRange_Validate(t *testing.T) { testCases := []struct { name string - in dayRange wantErrMsg string + in dayRange }{{ name: "empty", wantErrMsg: "", @@ -413,10 +413,10 @@ func TestWeekly_UnmarshalJSON(t *testing.T) { } testCases := []struct { + want *Weekly name string wantErrMsg string data []byte - want *Weekly }{{ name: "empty", wantErrMsg: "unexpected end of JSON input", @@ -478,9 +478,9 @@ func TestWeekly_MarshalJSON(t *testing.T) { } testCases := []struct { + want *Weekly name string data []byte - want *Weekly }{{ name: "empty", data: []byte(""), diff --git a/scripts/make/go-lint.sh b/scripts/make/go-lint.sh index 6571d90deb7..49c0344af11 100644 --- a/scripts/make/go-lint.sh +++ b/scripts/make/go-lint.sh @@ -218,6 +218,7 @@ run_linter gocognit --over='10'\ ./internal/filtering/hashprefix/\ ./internal/filtering/rulelist/\ ./internal/filtering/safesearch/\ + ./internal/ipset\ ./internal/next/\ ./internal/rdns/\ ./internal/schedule/\ @@ -257,9 +258,11 @@ run_linter fieldalignment \ ./internal/filtering/rewrite/\ ./internal/filtering/rulelist/\ ./internal/filtering/safesearch/\ + ./internal/ipset/\ ./internal/next/...\ ./internal/querylog/\ ./internal/rdns/\ + ./internal/schedule/\ ./internal/stats/\ ./internal/updater/\ ./internal/version/\ @@ -287,6 +290,7 @@ run_linter gosec --quiet\ ./internal/filtering/rewrite/\ ./internal/filtering/rulelist/\ ./internal/filtering/safesearch/\ + ./internal/ipset/\ ./internal/next/\ ./internal/rdns/\ ./internal/schedule/\