build: Enable gometalinter "unused" check

This commit is contained in:
Jakob Borg 2016-12-17 15:24:13 +01:00 committed by Jakob Borg
parent aa3ef49dd7
commit ead7281c20
4 changed files with 2 additions and 17 deletions

View File

@ -299,6 +299,7 @@ func runCommand(cmd string, target target) {
ok = gometalinter("structcheck", dirs) && ok ok = gometalinter("structcheck", dirs) && ok
ok = gometalinter("varcheck", dirs) && ok ok = gometalinter("varcheck", dirs) && ok
ok = gometalinter("ineffassign", dirs) && ok ok = gometalinter("ineffassign", dirs) && ok
ok = gometalinter("unused", dirs) && ok
if !ok { if !ok {
os.Exit(1) os.Exit(1)
} }
@ -369,6 +370,7 @@ func setup() {
"github.com/tsenart/deadcode", "github.com/tsenart/deadcode",
"golang.org/x/net/html", "golang.org/x/net/html",
"golang.org/x/tools/cmd/cover", "golang.org/x/tools/cmd/cover",
"honnef.co/go/unused/cmd/unused",
} }
for _, pkg := range packages { for _, pkg := range packages {
fmt.Println(pkg) fmt.Println(pkg)

View File

@ -54,7 +54,6 @@ func init() {
var ( var (
listen string listen string
debug bool debug bool
proto string
sessionAddress []byte sessionAddress []byte
sessionPort uint16 sessionPort uint16

View File

@ -1070,20 +1070,6 @@ func (m *Model) Closed(conn protocol.Connection, err error) {
close(closed) close(closed)
} }
// close will close the underlying connection for a given device
func (m *Model) close(device protocol.DeviceID) {
m.pmut.Lock()
conn, ok := m.conn[device]
m.pmut.Unlock()
if !ok {
// There is no connection to close
return
}
closeRawConn(conn)
}
// Request returns the specified data segment by reading it from local disk. // Request returns the specified data segment by reading it from local disk.
// Implements the protocol.Model interface. // Implements the protocol.Model interface.
func (m *Model) Request(deviceID protocol.DeviceID, folder, name string, offset int64, hash []byte, fromTemporary bool, buf []byte) error { func (m *Model) Request(deviceID protocol.DeviceID, folder, name string, offset int64, hash []byte, fromTemporary bool, buf []byte) error {

View File

@ -21,8 +21,6 @@ const (
// MaxMessageLen is the largest message size allowed on the wire. (500 MB) // MaxMessageLen is the largest message size allowed on the wire. (500 MB)
MaxMessageLen = 500 * 1000 * 1000 MaxMessageLen = 500 * 1000 * 1000
hdrSize = 6
) )
const ( const (