130 Commits (v3.24.2)

Author SHA1 Message Date
shirou 9de1a429b9
Merge pull request #1585 from DataDog/bryce.kahle/os-release-version-id
use VERSION_ID from os-release
Bryce Kahle d753f78612
use VERSION_ID from os-release
`VERSION_ID` is more appropriate for scripts and other usages, since `VERSION` can contain spaces and codenames

from `os-release` manpage:
```
VERSION=
           A string identifying the operating system version, excluding
           any OS name information, possibly including a release code
           name, and suitable for presentation to the user. This field
           is optional.

           Examples: "VERSION=17", "VERSION="17 (Beefy Miracle)"".

 VERSION_ID=
           A lower-case string (mostly numeric, no spaces or other
           characters outside of 0–9, a–z, ".", "_" and "-") identifying
           the operating system version, excluding any OS name
           information or release code name, and suitable for processing
           by scripts or usage in generated filenames. This field is
           optional.

           Examples: "VERSION_ID=17", "VERSION_ID=11.04".
```
Bryce Kahle b0d976c49b
ensure host platform are files and have contents
In a containerized deployment, it is common to mount several files from /etc. Within the container, those files will be created regardless if they exist on the host or not. In those instances, the existing code would erroneously return empty platform information.
shirou b10acd4894 [host]: add EnableBootTimeCache function
Justin Yang 7ffb24dbe3
Merge branch 'shirou:master' into feature/netbsd-arm64-port
Justin Yang 4a46201e00 cpu && host: fix compile time errors
shirou 0665cafa1b chore: replace deprecated ioutil package to os and io
Antoine Toulme 4ed0f1436a
return err if not EOF
Antoine Toulme ca71a6db3c
lint
Antoine Toulme 4bc9e37b0f
faster file read
Antoine Toulme 842e4da755 apply code review
Antoine Toulme 177e1b1982 remove deprecation comments
Antoine Toulme 0cbdf257ab change to use a typed map per code review
Antoine Toulme 5b9212e240 move the Env key out of internal packages
Antoine Toulme 38b94668ea allow to pass context values to override environment variables
shirou 3e789a459a [common]: fix potential leak on Sleep.
shirou 852f455217 fix lint
Ville Skyttä 70a8f589c6 Detect Docker also using /.dockerenv
Eng Zer Jun 37894e9b28
test: use `T.Setenv` to set env vars in tests
This commit replaces `os.Setenv` with `t.Setenv` in tests. The
environment variable is automatically restored to its original value
when the test and all its subtests complete.

Reference: https://pkg.go.dev/testing#T.Setenv
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
Aman Gupta Karmani 34cc43d282
[android][host] fix Info() failure due to forbidden /proc/stat and /proc/uptime (#1361)
* [android][host] fallback to sysinfo() syscall for uptime

with Android O, /proc/{stat,uptime} both return permission denied
shirou 769daafb9e
Merge pull request #1347 from atoulme/windows_errors
Return all Windows partitions
Antoine Toulme dbc0f20fe3 code review
shirou 16b3aac6ad
Merge pull request #1336 from johanburati/job043
Add hostinfo Virtualization hyperv
Ties de Wit f253d81d1b
Update common.go
Johan Burati e7034b47f2 Add hostinfo Virtualization hyperv
shirou 839e8b731f fix(common): simplify size check
shirou 5610fbc5d5 fix(host,linux): Check if path exists and is nonempty before reading host files
shirou 80c890dc4c fix(host,linux): when platform is detected to be 'amazon' cleanup os-release ID
shirou f11e3ba120 fix(net,linux): move IsLittleEndian to internal
Ville Skyttä f7e1f36418 refactor: remove unnecessary exec.LookPath calls
Executing the command does the lookup if needed and returns the same
error when not found, no need to do it separately.
Matthieu MOREL b0469a470b
Merge branch 'master' into master
Ville Skyttä 1e56c6f421 Spelling and grammar fixes
Matthieu MOREL 8ba220d241 enable contextcheck linter
shirou b4808b3e94
Merge pull request #1204 from YangKeao/fix-unstable-boottime
fix unstable boot time because of float conversion
shirou 2f8da0a394
Merge pull request #1205 from mmorel-35/master
enable more linters, report coverage and cache mods
Makazeu 521fafd945
Fix a typo in comment
Matthieu MOREL 851bffc0f1
enable gosec linter
mmorel-35 1e6b445a8a gofumpt
shirou 69ea4bfdae
Merge pull request #1194 from mmorel-35/master
Enable errorlint and gci linters
YangKeao 1b5757b7d1 fix unstable boot time because of float conversion
Signed-off-by: YangKeao <yangkeao@chunibyo.icu>
wyl 5a288fb852 Fix bug for func named ReadLinesOffsetN
Matthieu MOREL b673968d5d
enable errorlint linter
shirou d2e27c1712 fix dependabot v2 deletion.
shirou 0969c9436b delete v2 directory, move v3 to top #1078
shirou 0fdf65fa3e Change to use yusufpapurcu/wmi from StackExchange/wmi.
shirou 0ce33dbe64
Merge pull request #1166 from easyops-cn/kestrel/process
feat(process): implement the 'OpenFilesWithContext' function of the windows system
kestrel 3dabe50107 feat(process): implement the 'OpenFilesWithContext' function of the windows system
Ville Skyttä a21240a319 Simplify some if blocks
Ville Skyttä fb0c322260 Check error identity with errors.Is
Ville Skyttä 633e77013f Use short if