Skip to content

Commit

Permalink
Pull request: all: fix lint and naming issues vol. 4
Browse files Browse the repository at this point in the history
Merge in DNS/adguard-home from 2276-fix-lint-4 to master

Updates #2276.

Squashed commit of the following:

commit 15d4918
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Tue Dec 8 15:51:34 2020 +0300

    util: fix naming

commit 3b9a86a
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Tue Dec 8 15:41:10 2020 +0300

    all: fix lint and naming issues vol. 4
  • Loading branch information
ainar-g committed Dec 8, 2020
1 parent b7bf7f7 commit 73c3059
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 23 deletions.
6 changes: 6 additions & 0 deletions internal/agherr/agherr.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,9 @@ func (e *manyError) Unwrap() error {

return e.underlying[0]
}

// wrapper is a copy of the hidden errors.wrapper interface for tests, linting,
// etc.
type wrapper interface {
Unwrap() error
}
2 changes: 2 additions & 0 deletions internal/agherr/agherr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ func TestError_Error(t *testing.T) {
}

func TestError_Unwrap(t *testing.T) {
var _ wrapper = &manyError{}

const (
errSimple = iota
errWrapped
Expand Down
11 changes: 0 additions & 11 deletions internal/dnsfilter/dnsfilter.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,6 @@ const (
NotFilteredNotFound Reason = iota
// NotFilteredWhiteList - the host is explicitly whitelisted
NotFilteredWhiteList
// NotFilteredError - there was a transitive error during check
NotFilteredError

// reasons for filtering

Expand Down Expand Up @@ -777,12 +775,3 @@ func (d *Dnsfilter) Start() {
d.registerBlockedServicesHandlers()
}
}

//
// stats
//

// GetStats return dns filtering stats since startup.
func (d *Dnsfilter) GetStats() Stats {
return gctx.stats
}
3 changes: 2 additions & 1 deletion internal/sysutil/syslog_others.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
package sysutil

import (
"log"
"log/syslog"

"github.com/AdguardTeam/golibs/log"
)

func configureSyslog(serviceName string) error {
Expand Down
2 changes: 1 addition & 1 deletion internal/sysutil/syslog_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
package sysutil

import (
"log"
"strings"

"github.com/AdguardTeam/golibs/log"
"golang.org/x/sys/windows"
"golang.org/x/sys/windows/svc/eventlog"
)
Expand Down
File renamed without changes.
File renamed without changes.
8 changes: 0 additions & 8 deletions internal/util/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"io/ioutil"
"os"
"os/exec"
"path"
"runtime"
"strings"
)
Expand Down Expand Up @@ -41,13 +40,6 @@ func RunCommand(command string, arguments ...string) (int, string, error) {
return cmd.ProcessState.ExitCode(), string(out), nil
}

func FuncName() string {
pc := make([]uintptr, 10) // at least 1 entry needed
runtime.Callers(2, pc)
f := runtime.FuncForPC(pc[0])
return path.Base(f.Name())
}

// SplitNext - split string by a byte and return the first chunk
// Skip empty chunks
// Whitespace is trimmed
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package util

import (
"log"
"testing"
)

Expand All @@ -19,6 +18,6 @@ func TestGetValidNetInterfacesForWeb(t *testing.T) {
t.Fatalf("No addresses found for %s", iface.Name)
}

log.Printf("%v", iface)
t.Logf("%v", iface)
}
}

0 comments on commit 73c3059

Please sign in to comment.