Skip to content

Commit

Permalink
Clean up more lint errors.
Browse files Browse the repository at this point in the history
Also remove the 'vetshadow' linter, it's overly noisy on normal code.
  • Loading branch information
danderson committed Feb 6, 2018
1 parent 31095fd commit 99cc04c
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Makefile
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions pixiecore/booters.go
Expand Up @@ -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)
}
Expand Down
14 changes: 6 additions & 8 deletions pixiecore/dhcp_server.go
Expand Up @@ -18,16 +18,14 @@ 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
leases []lease
//dhcpConn *dhcp4.Conn // Used for sending only
//icmpConn icmp.PacketConn
leases []lease
}

const (
Expand All @@ -37,9 +35,9 @@ const (
)

type lease struct {
state int
mac net.HardwareAddr
expires time.Time
state int
//mac net.HardwareAddr
//expires time.Time
}

func newDHCPServer(address string, dhcpConn *dhcp4.Conn) (*dhcpServer, error) {
Expand Down
2 changes: 1 addition & 1 deletion pixiecore/urlsign.go
Expand Up @@ -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")
}
Expand Down
2 changes: 1 addition & 1 deletion tftp/tftp.go
Expand Up @@ -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)
Expand Down

0 comments on commit 99cc04c

Please sign in to comment.