mirror of https://github.com/shirou/gopsutil
[net][linux] Fix #1198 "f.ReadDir undefined" on Go 1.15 by redefining a custom readDir according to go version
Using os.File.Readdir pre Go 1.16 and os.File.ReadDir post Go 1.16pull/1215/head
parent
2f8da0a394
commit
d826e14e27
@ -0,0 +1,12 @@
|
||||
//go:build !go1.16
|
||||
// +build !go1.16
|
||||
|
||||
package net
|
||||
|
||||
import (
|
||||
"os"
|
||||
)
|
||||
|
||||
func readDir(f *os.File, max int) ([]os.FileInfo, error) {
|
||||
return f.Readdir(max)
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
//go:build go1.16
|
||||
// +build go1.16
|
||||
|
||||
package net
|
||||
|
||||
import (
|
||||
"os"
|
||||
)
|
||||
|
||||
func readDir(f *os.File, max int) ([]os.DirEntry, error) {
|
||||
return f.ReadDir(max)
|
||||
}
|
Loading…
Reference in New Issue