shirou
37f531010d
fix golangcilint errors, ignore gosec G115
2024-08-23 08:22:42 +00:00
shirou
1221983189
[windows][mem]: change to use Performance Counter on SwapMemory.
2024-07-21 16:21:06 +09:00
shirou
bc060cc227
add SPDX License, remove old build tag, and replace import
2024-05-28 22:27:17 +09:00
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.
2024-01-18 10:21:42 -08:00
shirou
0665cafa1b
chore: replace deprecated ioutil package to os and io
2023-09-08 17:05:14 +00:00
Antoine Toulme
4ed0f1436a
return err if not EOF
2023-08-25 14:39:29 -07:00
Antoine Toulme
4bc9e37b0f
faster file read
2023-08-25 13:54:26 -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
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
Ties de Wit
f253d81d1b
Update common.go
2022-09-01 09:18:20 +02: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
Ville Skyttä
1e56c6f421
Spelling and grammar fixes
2022-01-30 22:48:09 +02: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
mmorel-35
1e6b445a8a
gofumpt
2021-12-22 21:54:41 +00:00
wyl
5a288fb852
Fix bug for func named ReadLinesOffsetN
2021-12-20 09:07:46 +08:00
shirou
0969c9436b
delete v2 directory, move v3 to top #1078
2021-11-30 23:47:59 +00:00
Ville Skyttä
5d0724f42f
Comment convention fixes
2021-08-18 17:09:03 +03:00
Ville Skyttä
a9b1ce2dec
Remove unnecessary conversions
2021-08-18 16:42:11 +03:00
shirou
2fa855f295
add MockEnv as more generic function.
2021-05-08 21:18:46 +09:00
Sergey Vinogradov
8ff2ab3187
Add "vet" target to the Makefile
...
Making the "vet" target will run "go vet ./..." for each supported
GOOS.
Also, some of the warnings produced by go 1.15 vet were mitigated.
2020-10-10 16:50:49 +03:00
Mihir Singh
92d6df6d8f
Attempted LXC guest detection from environ procfile
2020-06-21 09:13:34 +00:00
Ilya Prudnikov
256e00319e
implement proposed solution
2020-01-20 20:13:45 +02:00
shirou
5335e3fd50
Merge pull request #685 from cmattoon/conntrack-stat
...
Adds ConntrackStats (/proc/net/stat/nf_conntrack)
2019-06-01 11:50:09 +09:00
Curtis Mattoon
648bf4eebc
Adds ConntrackStats to get conntrack summary stats
2019-05-11 12:45:05 -04:00
Lomanic
0e0dd767df
[process][darwin] Fix #670 remove call to common.Pipeline (prone to race condition)
...
Also properly parse lsof to get second txt record instead of hoping the 5th line is the right one (wrong data returned for pid 57)
2019-05-08 18:17:56 +02:00
Jaime Soriano Pastor
61902bc2a5
Use HOST_* environment variables for getting disk serial number in Linux
2018-07-02 10:04:57 +02:00
shirou
145dca90f7
change to use CommandContext.
2018-03-31 21:35:53 +09:00
Daniel Nelson
df2f1a8dd1
Add HOST_VAR envvar and use to locate utmp on Linux.
2017-10-16 14:53:14 -07:00
Michael Schurter
042305ee4a
Remove SetEnv on all platforms
2017-08-16 15:32:21 -07:00
Sean Chittenden
d0e40ff723
Fix issues reported by golint.
2017-04-27 14:21:34 -07:00
Sean Chittenden
3834908232
Improve Command() handling and signal handling for launched processes.
2017-04-27 14:11:25 -07:00
WAKAYAMA Shirou
30ebb9ca3a
rename expected dir to testdata.
2017-03-15 23:01:06 +09:00
Cameron Sparr
a213bf5e6d
run go fmt ./...
2017-02-01 23:05:29 +00:00
Nex
5c0ac28fed
Changing a little the return values
2016-10-21 13:19:19 +02:00
Nex
d9b355f75e
Added proper piping of commands
2016-10-21 13:16:22 +02:00
Sean Chittenden
e4f857a9ca
Fix a linter issue: s/TimeoutErr/ErrTimeout/g
2016-08-11 00:49:29 -07:00
Shirou WAKAYAMA
57f6aebc7e
add Timeout to invoke command and use common.Invoke refs: #201
2016-05-20 17:59:41 +09:00
Shirou WAKAYAMA
0787e8ba3e
[host]linux-arm: update type_liux.go. Test will fail.
2016-04-10 10:07:35 +00:00
Shirou WAKAYAMA
613a8a90e1
fixed by golint.
2016-04-01 21:34:39 +09:00
Shirou WAKAYAMA
fa3e1cc196
[common]linux: add HostEtc to switch '/etc' See #175 .
2016-03-13 23:42:06 +09:00
Shirou WAKAYAMA
6c352016d8
[net]linux: start replacing lsof. still work in progress.
2016-03-01 23:38:13 +09:00
Shawn Smith
9cc9e82920
fix typos
2015-12-31 14:23:13 +09:00
James Lamb
22f35fd518
add netfilter counter support
2015-12-08 09:32:45 +11:00