diff --git a/.github/labeler.yml b/.github/labeler.yml new file mode 100644 index 0000000..6791f27 --- /dev/null +++ b/.github/labeler.yml @@ -0,0 +1,54 @@ +package:cpu: + - cpu/* +package:disk: + - disk/* +package:docker: + - docker/* +package:host: + - host/* +package:load: + - load/* +package:mem: + - mem/* +package:net: + - net/* +package:process: + - process/* +package:winservices: + - winservices/* +os:linux: + - ./**/*_linux.go + - ./**/*_linux_mips64.go + - ./**/*_linux_386.go + - ./**/*_linux_test.go + - ./**/*_linux_s390x.go + - ./**/*_linux_amd64.go + - ./**/*_posix.go +os:freebsd: + - ./**/*_freebsd.go + - ./**/*_freebsd_386.go + - ./**/*_freebsd_test.go + - ./**/*_freebsd_amd64.go + - ./**/*_bsd.go + - ./**/*_posix.go +os:darwin: + - ./**/*_darwin.go + - ./**/*_darwin_386.go + - ./**/*_darwin_test.go + - ./**/*_darwin_amd64.go + - ./**/*_posix.go +os:openbsd: + - ./**/*_openbsd.go + - ./**/*_openbsd_386.go + - ./**/*_openbsd_test.go + - ./**/*_openbsd_amd64.go + - ./**/*_bsd.go + - ./**/*_posix.go +os:windows: + - ./**/*_windows.go + - ./**/*_windows_386.go + - ./**/*_windows_test.go + - ./**/*_windows_amd64.go +os:solaris: + - ./**/*_solaris.go + - ./**/*_posix.go diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml new file mode 100644 index 0000000..dcafb97 --- /dev/null +++ b/.github/workflows/labeler.yml @@ -0,0 +1,11 @@ +name: "Pull Request Labeler" +on: +- pull_request + +jobs: + triage: + runs-on: ubuntu-latest + steps: + - uses: actions/labeler@v2 + with: + repo-token: "${{ secrets.GITHUB_TOKEN }}" diff --git a/disk/disk_darwin.go b/disk/disk_darwin.go index d64d15c..b0fc29a 100644 --- a/disk/disk_darwin.go +++ b/disk/disk_darwin.go @@ -4,7 +4,6 @@ package disk import ( "context" - "path" "github.com/shirou/gopsutil/internal/common" "golang.org/x/sys/unix" @@ -14,6 +13,8 @@ func Partitions(all bool) ([]PartitionStat, error) { return PartitionsWithContext(context.Background(), all) } +// PartitionsWithContext returns disk partition. +// 'all' argument is ignored, see: https://github.com/giampaolo/psutil/issues/906 func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, error) { var ret []PartitionStat @@ -69,11 +70,6 @@ func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, erro Fstype: common.ByteToString(stat.Fstypename[:]), Opts: opts, } - if all == false { - if !path.IsAbs(d.Device) || !common.PathExists(d.Device) { - continue - } - } ret = append(ret, d) } diff --git a/disk/disk_freebsd.go b/disk/disk_freebsd.go index f172828..9882781 100644 --- a/disk/disk_freebsd.go +++ b/disk/disk_freebsd.go @@ -6,7 +6,6 @@ import ( "bytes" "context" "encoding/binary" - "path" "strconv" "golang.org/x/sys/unix" @@ -18,6 +17,8 @@ func Partitions(all bool) ([]PartitionStat, error) { return PartitionsWithContext(context.Background(), all) } +// PartitionsWithContext returns disk partition. +// 'all' argument is ignored, see: https://github.com/giampaolo/psutil/issues/906 func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, error) { var ret []PartitionStat @@ -89,11 +90,6 @@ func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, erro Fstype: common.ByteToString(stat.Fstypename[:]), Opts: opts, } - if all == false { - if !path.IsAbs(d.Device) || !common.PathExists(d.Device) { - continue - } - } ret = append(ret, d) } diff --git a/disk/disk_openbsd.go b/disk/disk_openbsd.go index cd9e294..741aa89 100644 --- a/disk/disk_openbsd.go +++ b/disk/disk_openbsd.go @@ -6,7 +6,6 @@ import ( "bytes" "context" "encoding/binary" - "path" "github.com/shirou/gopsutil/internal/common" "golang.org/x/sys/unix" @@ -16,6 +15,8 @@ func Partitions(all bool) ([]PartitionStat, error) { return PartitionsWithContext(context.Background(), all) } +// PartitionsWithContext returns disk partition. +// 'all' argument is ignored, see: https://github.com/giampaolo/psutil/issues/906 func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, error) { var ret []PartitionStat @@ -66,11 +67,6 @@ func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, erro Fstype: common.IntToString(stat.F_fstypename[:]), Opts: opts, } - if all == false { - if !path.IsAbs(d.Device) || !common.PathExists(d.Device) { - continue - } - } ret = append(ret, d) }