Skip to content

Commit

Permalink
Fix lint errors
Browse files Browse the repository at this point in the history
Signed-off-by: Kirtana Ashok <kiashok@microsoft.com>
  • Loading branch information
kiashok committed Feb 27, 2024
1 parent 8d18af3 commit b0f4812
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion ext4/dmverity/dmverity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ package dmverity

import (
"bytes"
"crypto/rand"
"encoding/binary"
"errors"
"io"
"math/rand"
"os"
"strings"
"testing"
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/io_npipe.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (

func init() {
// Need to seed for the rng in backoff.NextBackoff()
rand.Seed(time.Now().UnixNano())
rand.New(rand.NewSource(time.Now().UnixNano()))
}

// NewNpipeIO creates connected upstream io. It is the callers responsibility to validate that `if terminal == true`, `stderr == ""`. retryTimeout
Expand Down
4 changes: 3 additions & 1 deletion internal/tools/networkagent/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import (
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"

crypto "crypto/rand"

"github.com/Microsoft/hcsshim/hcn"
"github.com/Microsoft/hcsshim/internal/log"
ncproxygrpc "github.com/Microsoft/hcsshim/pkg/ncproxy/ncproxygrpc/v1"
Expand All @@ -39,7 +41,7 @@ const (
func generateMAC() (string, error) {
buf := make([]byte, 6)

_, err := rand.Read(buf)
_, err := crypto.Read(buf)
if err != nil {
return "", err
}
Expand Down
7 changes: 1 addition & 6 deletions internal/winapi/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ package winapi

import (
"errors"
"reflect"
"syscall"
"unsafe"

Expand All @@ -14,11 +13,7 @@ import (
// Uint16BufferToSlice wraps a uint16 pointer-and-length into a slice
// for easier interop with Go APIs
func Uint16BufferToSlice(buffer *uint16, bufferLength int) (result []uint16) {
hdr := (*reflect.SliceHeader)(unsafe.Pointer(&result))
hdr.Data = uintptr(unsafe.Pointer(buffer))
hdr.Cap = bufferLength
hdr.Len = bufferLength

result = unsafe.Slice(buffer, bufferLength)
return
}

Expand Down

0 comments on commit b0f4812

Please sign in to comment.