Commit Graph

123 Commits

Author SHA1 Message Date
Antoine Toulme 4ed0f1436a
return err if not EOF 2023-08-25 14:39:29 -07:00
Antoine Toulme ca71a6db3c
lint 2023-08-25 14:38:11 -07:00
Antoine Toulme 4bc9e37b0f
faster file read 2023-08-25 13:54:26 -07:00
Antoine Toulme 842e4da755 apply code review 2023-06-02 01:31:05 -07:00
Antoine Toulme 177e1b1982 remove deprecation comments 2023-06-02 01:31:05 -07:00
Antoine Toulme 0cbdf257ab change to use a typed map per code review 2023-06-02 01:31:05 -07:00
Antoine Toulme 5b9212e240 move the Env key out of internal packages 2023-06-02 01:31:05 -07:00
Antoine Toulme 38b94668ea allow to pass context values to override environment variables 2023-06-02 01:31:05 -07:00
shirou 3e789a459a [common]: fix potential leak on Sleep. 2023-05-28 12:32:10 +00:00
shirou 852f455217 fix lint 2023-02-12 09:24:52 +00:00
Ville Skyttä 70a8f589c6 Detect Docker also using /.dockerenv 2022-12-28 23:12:58 +02:00
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>
2022-12-20 13:13:01 +08:00
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
2022-11-19 04:17:18 +01:00
shirou 769daafb9e
Merge pull request #1347 from atoulme/windows_errors
Return all Windows partitions
2022-10-09 12:55:42 +09:00
Antoine Toulme dbc0f20fe3 code review 2022-10-03 13:55:14 -07:00
shirou 16b3aac6ad
Merge pull request #1336 from johanburati/job043
Add hostinfo Virtualization hyperv
2022-09-30 17:33:58 +09:00
Ties de Wit f253d81d1b
Update common.go 2022-09-01 09:18:20 +02:00
Johan Burati e7034b47f2 Add hostinfo Virtualization hyperv 2022-08-02 16:23:43 +09:00
shirou 839e8b731f fix(common): simplify size check 2022-07-19 12:43:41 +00:00
shirou 5610fbc5d5 fix(host,linux): Check if path exists and is nonempty before reading host files 2022-07-15 12:25:44 +00:00
shirou 80c890dc4c fix(host,linux): when platform is detected to be 'amazon' cleanup os-release ID 2022-07-12 09:53:22 +00:00
shirou f11e3ba120 fix(net,linux): move IsLittleEndian to internal 2022-07-04 08:41:25 +00:00
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.
2022-03-04 18:56:33 +02:00
Matthieu MOREL b0469a470b
Merge branch 'master' into master 2022-02-01 19:28:26 +01:00
Ville Skyttä 1e56c6f421 Spelling and grammar fixes 2022-01-30 22:48:09 +02:00
Matthieu MOREL 8ba220d241 enable contextcheck linter 2022-01-24 09:26:50 +01:00
shirou b4808b3e94
Merge pull request #1204 from YangKeao/fix-unstable-boottime
fix unstable boot time because of float conversion
2022-01-06 21:09:53 +09:00
shirou 2f8da0a394
Merge pull request #1205 from mmorel-35/master
enable more linters, report coverage and cache mods
2021-12-29 22:31:24 +09:00
Makazeu 521fafd945
Fix a typo in comment 2021-12-24 17:14:50 +08:00
Matthieu MOREL 851bffc0f1
enable gosec linter 2021-12-23 00:31:04 +01:00
mmorel-35 1e6b445a8a gofumpt 2021-12-22 21:54:41 +00:00
shirou 69ea4bfdae
Merge pull request #1194 from mmorel-35/master
Enable errorlint and gci linters
2021-12-22 21:43:03 +09:00
YangKeao 1b5757b7d1 fix unstable boot time because of float conversion
Signed-off-by: YangKeao <yangkeao@chunibyo.icu>
2021-12-21 16:14:07 +08:00
wyl 5a288fb852 Fix bug for func named ReadLinesOffsetN 2021-12-20 09:07:46 +08:00
Matthieu MOREL b673968d5d
enable errorlint linter 2021-12-04 22:29:38 +01:00
shirou d2e27c1712 fix dependabot v2 deletion. 2021-12-01 00:12:55 +00:00
shirou 0969c9436b delete v2 directory, move v3 to top #1078 2021-11-30 23:47:59 +00:00
shirou 0fdf65fa3e Change to use yusufpapurcu/wmi from StackExchange/wmi. 2021-11-20 11:36:30 +00:00
shirou 0ce33dbe64
Merge pull request #1166 from easyops-cn/kestrel/process
feat(process): implement the 'OpenFilesWithContext' function of the windows system
2021-11-13 20:51:25 +09:00
kestrel 3dabe50107 feat(process): implement the 'OpenFilesWithContext' function of the windows system 2021-10-11 05:30:29 +08:00
Ville Skyttä a21240a319 Simplify some if blocks 2021-08-18 17:09:11 +03:00
Ville Skyttä fb0c322260 Check error identity with errors.Is 2021-08-18 17:09:11 +03:00
Ville Skyttä 633e77013f Use short if 2021-08-18 17:09:11 +03:00
Ville Skyttä ce9d35436e Merge variable declaration with assignment 2021-08-18 17:09:11 +03:00
Ville Skyttä 5d0724f42f Comment convention fixes 2021-08-18 17:09:03 +03:00
Ville Skyttä 65616500e8 Remove unnecessary empty lines 2021-08-18 16:42:17 +03:00
Ville Skyttä a9b1ce2dec Remove unnecessary conversions 2021-08-18 16:42:11 +03:00
Ville Skyttä 7743265113 Rewrite if-else chains as switches 2021-08-18 16:37:51 +03:00
shirou 2fa855f295 add MockEnv as more generic function. 2021-05-08 21:18:46 +09:00
Johannes Drummer 76fb312c4b delete unused PdhAddCounterW 2021-02-06 13:11:41 +01:00