mirror of
https://github.com/mmatczuk/go-http-tunnel.git
synced 2026-05-15 14:16:17 -06:00
makefile: added megacheck
This commit is contained in:
parent
15d593924b
commit
b7ceebebff
6 changed files with 16 additions and 15 deletions
13
Makefile
13
Makefile
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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...)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ func newRegistry(logger log.Logger) *registry {
|
|||
|
||||
return ®istry{
|
||||
items: make(map[id.ID]*RegistryItem),
|
||||
hosts: make(map[string]*hostInfo, 0),
|
||||
hosts: make(map[string]*hostInfo),
|
||||
logger: logger,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue