Clean up more lint errors.

Also remove the 'vetshadow' linter, it's overly noisy on normal code.
This commit is contained in:
David Anderson 2018-02-05 20:51:17 -08:00
parent 31095fd432
commit 99cc04c381
5 changed files with 11 additions and 13 deletions

View File

@ -31,7 +31,7 @@ ci-test:
ci-lint:
$(GOCMD) get -u github.com/alecthomas/gometalinter
gometalinter --install golint
gometalinter --deadline=1m --disable-all --enable=gofmt --enable=golint --enable=vet --enable=vetshadow --enable=structcheck --enable=unconvert --vendor ./...
gometalinter --deadline=1m --disable-all --enable=gofmt --enable=golint --enable=vet --enable=structcheck --enable=unconvert --vendor ./...
.PHONY: update-ipxe
update-ipxe:

View File

@ -102,14 +102,14 @@ func (s *staticBooter) ReadBootFile(id ID) (io.ReadCloser, int64, error) {
return s.serveFile(s.kernel)
case strings.HasPrefix(path, "initrd-"):
i, err := strconv.Atoi(string(path[7:]))
i, err := strconv.Atoi(path[7:])
if err != nil || i < 0 || i >= len(s.initrd) {
return nil, -1, fmt.Errorf("no file with ID %q", id)
}
return s.serveFile(s.initrd[i])
case strings.HasPrefix(path, "other-"):
i, err := strconv.Atoi(string(path[6:]))
i, err := strconv.Atoi(path[6:])
if err != nil || i < 0 || i >= len(s.otherIDs) {
return nil, -1, fmt.Errorf("no file with ID %q", id)
}

View File

@ -18,15 +18,13 @@ import (
"errors"
"fmt"
"net"
"time"
"go.universe.tf/netboot/dhcp4"
"golang.org/x/net/icmp"
)
type dhcpServer struct {
dhcpConn *dhcp4.Conn // Used for sending only
icmpConn icmp.PacketConn
//dhcpConn *dhcp4.Conn // Used for sending only
//icmpConn icmp.PacketConn
leases []lease
}
@ -38,8 +36,8 @@ const (
type lease struct {
state int
mac net.HardwareAddr
expires time.Time
//mac net.HardwareAddr
//expires time.Time
}
func newDHCPServer(address string, dhcpConn *dhcp4.Conn) (*dhcpServer, error) {

View File

@ -58,7 +58,7 @@ func getURL(id ID, key *[32]byte) (string, error) {
var nonce [24]byte
copy(nonce[:], signed)
out, ok := secretbox.Open(nil, []byte(signed[24:]), &nonce, key)
out, ok := secretbox.Open(nil, signed[24:], &nonce, key)
if !ok {
return "", errors.New("signature verification failed")
}

View File

@ -222,7 +222,7 @@ func (s *Server) transfer(addr net.Addr, req *rrq) error {
conn.Write(tftpError("internal server error"))
return fmt.Errorf("writing seqnum: %s", err)
}
n, err := io.CopyN(&b, file, int64(req.BlockSize))
n, err := io.CopyN(&b, file, req.BlockSize)
if err != nil && err != io.EOF {
conn.Write(tftpError("internal server error"))
return fmt.Errorf("reading bytes for block %d: %s", seq, err)