Skip to content

Partitions on Windows #1396

Closed
Closed
@roborobs1023

Description

Describe the bug
Getting a invalid memory address or null pointer difference error when running the following code.

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x20 pc=0xeaab8a]

goroutine 1 [running]:
github.com/shirou/gopsutil/v3/disk.PartitionsWithContext({0xc000046000?, 0xc0000c9f70?}, 0x69?)
        C:/Users/rtucker/go/pkg/mod/github.com/shirou/gopsutil/[email protected]/disk/disk_windows.go:107 +0x20a
github.com/shirou/gopsutil/v3/disk.Partitions(...)
        C:/Users/rtucker/go/pkg/mod/github.com/shirou/gopsutil/[email protected]/disk/disk.go:77
main.CalcDiskSpace()
        E:/Coding/Testing/Go/mxlookup/main.go:319 +0x29
main.main()

To Reproduce

319 parts, _ := disk.Partitions(false)
320 fmt.Println(parts)

Expected behavior
I expected it to return a list of the Partitions as the function does in older versions of the module. However in V3 I'm getting the above error.

Environment (please complete the following information):

  • Windows: Windows 10 Build 1904

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions