diff --git a/virtcontainers/hyperstart_agent.go b/virtcontainers/hyperstart_agent.go index 251e705ea9..4b29ef5d11 100644 --- a/virtcontainers/hyperstart_agent.go +++ b/virtcontainers/hyperstart_agent.go @@ -637,7 +637,7 @@ func (h *hyper) processListOneContainer(podID, cID string, options ProcessListOp func (h *hyper) connectProxyRetry(scheme, address string) (conn net.Conn, err error) { attempt := 1 - timeoutSecs := time.Duration(waitForProxyTimeoutSecs * time.Second) + timeoutSecs := waitForProxyTimeoutSecs * time.Second startTime := time.Now() lastLogTime := startTime diff --git a/virtcontainers/hypervisor.go b/virtcontainers/hypervisor.go index 5f111ed6c1..e9538b9b33 100644 --- a/virtcontainers/hypervisor.go +++ b/virtcontainers/hypervisor.go @@ -131,7 +131,7 @@ func newHypervisor(hType HypervisorType) (hypervisor, error) { func makeNameID(namedType string, id string) string { nameID := fmt.Sprintf("%s-%s", namedType, id) if len(nameID) > maxDevIDSize { - nameID = string(nameID[:maxDevIDSize]) + nameID = nameID[:maxDevIDSize] } return nameID diff --git a/virtcontainers/pkg/hyperstart/hyperstart.go b/virtcontainers/pkg/hyperstart/hyperstart.go index 6ed35af58e..991dfc88b3 100644 --- a/virtcontainers/pkg/hyperstart/hyperstart.go +++ b/virtcontainers/pkg/hyperstart/hyperstart.go @@ -345,7 +345,7 @@ func (h *Hyperstart) WriteCtlMessage(conn net.Conn, m *DecodedMessage) error { return fmt.Errorf("message too long %d", length) } msg := make([]byte, length) - binary.BigEndian.PutUint32(msg[:], uint32(m.Code)) + binary.BigEndian.PutUint32(msg[:], m.Code) binary.BigEndian.PutUint32(msg[CtlHdrLenOffset:], uint32(length)) copy(msg[CtlHdrSize:], m.Message) diff --git a/virtcontainers/pkg/hyperstart/mock/hyperstart.go b/virtcontainers/pkg/hyperstart/mock/hyperstart.go index f4d399f83e..b2df6de946 100644 --- a/virtcontainers/pkg/hyperstart/mock/hyperstart.go +++ b/virtcontainers/pkg/hyperstart/mock/hyperstart.go @@ -285,7 +285,7 @@ func (h *Hyperstart) SendIo(seq uint64, data []byte) { h.logf("io: <-- writing %d bytes for seq %d\n", len(data), seq) - binary.BigEndian.PutUint64(header[:], uint64(seq)) + binary.BigEndian.PutUint64(header[:], seq) binary.BigEndian.PutUint32(header[8:], uint32(length)) h.writeIo(header) diff --git a/virtcontainers/pkg/mock/cc_proxy_mock.go b/virtcontainers/pkg/mock/cc_proxy_mock.go index af7431ff3d..1cc4bc2e42 100644 --- a/virtcontainers/pkg/mock/cc_proxy_mock.go +++ b/virtcontainers/pkg/mock/cc_proxy_mock.go @@ -429,7 +429,7 @@ func (proto *ccProxyProtocol) handleCommand(ctx *clientCtx, cmd *api.Frame) *api // cmd.Header.Opcode is guaranteed to be within the right bounds by // ReadFrame(). - handler := proto.cmdHandlers[FrameKey{cmd.Header.Type, int(cmd.Header.Opcode)}] + handler := proto.cmdHandlers[FrameKey{cmd.Header.Type, cmd.Header.Opcode}] handler(cmd.Payload, ctx.userData, &hr) if hr.err != nil { diff --git a/virtcontainers/pkg/uuid/uuid.go b/virtcontainers/pkg/uuid/uuid.go index 219f19d96b..c7df53a42d 100644 --- a/virtcontainers/pkg/uuid/uuid.go +++ b/virtcontainers/pkg/uuid/uuid.go @@ -133,7 +133,7 @@ func (u UUID) String() string { clkSeqLow := u[9] buf := make([]byte, 8) copy(buf[2:], u[10:]) - node := uint64(binary.BigEndian.Uint64(buf)) + node := binary.BigEndian.Uint64(buf) return fmt.Sprintf("%08x-%04x-%04x-%02x%02x-%012x", timeLow, timeMid, timeHi, clkSeqHi, clkSeqLow, node)