Merge pull request #35 from mmatczuk/megacheck

makefile: added megacheck
This commit is contained in:
Michał Matczuk 2017-10-07 00:03:48 +02:00 committed by GitHub
commit 97ac39f415
6 changed files with 16 additions and 15 deletions

View file

@ -5,7 +5,7 @@ clean:
@go clean -r
.PHONY: check
check: .check-fmt .check-vet .check-lint .check-misspell .check-ineffassign
check: .check-fmt .check-vet .check-lint .check-ineffassign .check-mega .check-misspell
.PHONY: .check-fmt
.check-fmt:
@ -22,13 +22,17 @@ check: .check-fmt .check-vet .check-lint .check-misspell .check-ineffassign
| grep -v /tunnelmock/ \
| tee /dev/stderr | ifne false
.PHONY: .check-ineffassign
.check-ineffassign:
@ineffassign ./
.PHONY: .check-misspell
.check-misspell:
@misspell ./...
.PHONY: .check-ineffassign
.check-ineffassign:
@ineffassign ./
.PHONY: .check-mega
.check-mega:
@megacheck ./...
.PHONY: test
test:
@ -51,6 +55,7 @@ get-tools:
@go get -u github.com/gordonklaus/ineffassign
@go get -u github.com/mitchellh/gox
@go get -u github.com/tcnksm/ghr
@go get -u honnef.co/go/tools/cmd/megacheck
#OUTPUT_DIR = build
#OS = "darwin freebsd linux windows"

View file

@ -42,8 +42,7 @@ func (c *Context) WithPrefix(keyvals ...interface{}) *Context {
// Log adds prefix and suffix to keyvals and calls internal logger.
func (c *Context) Log(keyvals ...interface{}) error {
var s []interface{}
s = append(c.prefix, keyvals...)
s := append(c.prefix, keyvals...)
s = append(s, c.suffix...)
return c.logger.Log(s...)
}

View file

@ -41,8 +41,7 @@ func NewLogger(to string, level int) (Logger, error) {
log.SetOutput(w)
var l Logger
l = NewStdLogger()
l := NewStdLogger()
l = NewFilterLogger(l, level)
return l, nil
}

View file

@ -45,7 +45,7 @@ func newRegistry(logger log.Logger) *registry {
return &registry{
items: make(map[id.ID]*RegistryItem),
hosts: make(map[string]*hostInfo, 0),
hosts: make(map[string]*hostInfo),
logger: logger,
}
}

View file

@ -232,8 +232,9 @@ func (s *Server) handleClient(conn net.Conn) {
{
ctx, cancel := context.WithTimeout(context.Background(), DefaultTimeout)
defer cancel()
req.WithContext(ctx)
req = req.WithContext(ctx)
}
resp, err = s.httpClient.Do(req)
if err != nil {
logger.Log(
@ -334,9 +335,8 @@ func (s *Server) notifyError(serverError error, identifier id.ID) {
ctx, cancel := context.WithTimeout(context.Background(), DefaultTimeout)
defer cancel()
req.WithContext(ctx)
s.httpClient.Do(req)
s.httpClient.Do(req.WithContext(ctx))
}
// addTunnels invokes addHost or addListener based on data from proto.Tunnel. If

View file

@ -34,9 +34,7 @@ func (_m *MockLogger) EXPECT() *_MockLoggerRecorder {
func (_m *MockLogger) Log(_param0 ...interface{}) error {
_s := []interface{}{}
for _, _x := range _param0 {
_s = append(_s, _x)
}
_s = append(_s, _param0...)
ret := _m.ctrl.Call(_m, "Log", _s...)
ret0, _ := ret[0].(error)
return ret0