Commit graph

19 commits

Author SHA1 Message Date
alliasgher
ae063a499a util/runtime: simplify TestFsType comment per review
Remove issue reference and trim the comment down to the assertion's
intent, per @roidelapluie review.

Signed-off-by: alliasgher <alliasgher123@gmail.com>
2026-04-15 15:54:02 +05:00
alliasgher
6994b4cb4e util/runtime: simplify TestFsType to check != 0 instead of _MAGIC
Signed-off-by: alliasgher <alliasgher123@gmail.com>
2026-04-14 20:26:13 +05:00
Ali
48f4a41e38 util/runtime: skip TestFsType on unknown filesystems instead of accepting hex format
Rather than widening the assertion to accept raw hex codes, skip the
strict _MAGIC format check with t.Skipf when the filesystem is not in
the known map. The test still exercises the error paths and will run
fully on standard Linux/macOS filesystems.

Fixes prometheus/prometheus#18471

Signed-off-by: Ali <ali@kscope.ai>
2026-04-14 16:49:46 +05:00
Ali
366ee531bb util/runtime: let TestFsType tolerate filesystems absent from FsType map
FsType() returns the known magic-name string when the filesystem is
present in its internal map, and falls back to strconv.FormatInt(..., 16)
otherwise. The test was asserting the *MAGIC regex only, so it failed
whenever it happened to run on a filesystem not yet mapped — the
downstream Arch Linux packager hit this with a btrfs subvolume.

Extend the regex to accept either a magic-name or the numeric
lowercase-hex fallback, keeping the test stable across OS upgrades and
exotic filesystems.

Fixes #18471

Signed-off-by: Ali <alliasgher123@gmail.com>
2026-04-14 01:21:26 +05:00
Justin Kromlinger
0d9776a3a4
Update FsType magic list
Taken from `/usr/include/linux/magic.h` with linux-api-headers v6.19.

Includes newer popular filesystems like btrfs.

Also see #18471.

Signed-off-by: Justin Kromlinger <hashworks@archlinux.org>
2026-04-08 11:02:49 +02:00
Julien Pivotto
8b4318ad34 util/runtime: cast Blocks to uint64 to fix type mismatch on different architectures
On some GOOS (e.g. dragonfly), statfs.Blocks is int64, which can
cause a type mismatch when multiplied with Bsize. Cast both operands to
uint64 explicitly.

Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
2026-02-27 15:49:17 +01:00
Jérôme LOYET
696679e50c Add storage.tsdb.retention.percentage config
Signed-off-by: Jérôme LOYET <822436+fatpat@users.noreply.github.com>
Signed-off-by: Laurent Dufresne <laurent.dufresne@grafana.com>
2026-02-24 15:27:45 +01:00
Ben Kochie
e14795bbf4
Remove copyright date from headers (#17785)
Remove copyright dates from various files as part of [PROM-50].

[PROM-50]: https://github.com/prometheus/proposals/blob/main/proposals/0050-remove-copyright-dates.md

Signed-off-by: SuperQ <superq@gmail.com>
2026-01-05 13:46:21 +01:00
Nathan Baulch
50cd453c8f
chore: Fix typos (#14868)
* Fix typos

---------

Signed-off-by: Nathan Baulch <nathan.baulch@gmail.com>
2024-09-10 22:32:03 +02:00
Arve Knudsen
0853e52f4e
util/runtime: Ignore nolintlint failure on OSX (#13546)
util/runtime: Make nolintlint ignore unconvert linter directive

---------

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2024-02-06 13:53:37 +01:00
tyltr
f97fa2736c remove obsolete build tag
Signed-off-by: tyltr <tylitianrui@126.com>
2024-01-17 22:26:32 +08:00
Oleksandr Redko
fa90ca46e5 ci(lint): enable godot; append dot at the end of comments
Signed-off-by: Oleksandr Redko <Oleksandr_Redko@epam.com>
2023-10-31 19:53:38 +02:00
Julien Pivotto
7f29458e69
Merge pull request #12231 from Loongson-Cloud-Community/main
fix: RLIM_INFINITY type is uint64 on loong64
2023-05-28 15:12:34 +02:00
Julien Pivotto
637235f0a6 Revert type casting removal
This reverts the removal of type casting due to an error in the
dragonfly integration. The change in the type casting introduced by the
commit causes a type mismatch, resulting in the following errors:

util/runtime/limits_default.go:42:57: cannot use rlimit.Cur (variable of type int64) as type uint64 in argument to limitToString
util/runtime/limits_default.go:42:90: cannot use rlimit.Max (variable of type int64) as type uint64 in argument to limitToString

Reverting this commit to resolve the type mismatch error and maintain compatibility with the dragonfly integration.

Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>
2023-04-20 16:36:25 +02:00
Matthieu MOREL
fb3eb21230 enable gocritic, unconvert and unused linters
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2023-04-13 19:20:22 +00:00
znley
0c75f76193 fix: RLIM_INFINITY type is uint64 on loong64
Signed-off-by: znley <shanjiantao@loongson.cn>
2023-04-06 15:21:51 +08:00
Tobias Klauser
7ef6f287cf
util/runtime: use ByteSliceToString from golang.org/x/sys/unix in Uname (#11070)
Use unix.ByteSliceToString to convert Utsname []byte fields to strings.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2022-07-30 19:35:03 +02:00
Łukasz Mierzwa
a4317bf0ec
Run gofumpt on all files (#10392)
* Run gofumpt on all files

Getting golangci-lint errors when building on my laptop, possibly because I have newer version of gofumpt then what it was formatted with.
Run gofumpt -w -extra on all files as it will be needed in the future anyway.

* Update golangci-lint to v1.44.2

v1.44.0 upgraded gofumpt so bumping version in CI will help keep formatting correct for everyone

* Address golangci-lint error

Getting 'error-strings: error strings should not be capitalized or end with punctuation or a newline' from revive here.
Drop new line.

Signed-off-by: Łukasz Mierzwa <l.mierzwa@gmail.com>
2022-03-03 17:21:05 +01:00
beorn7
c954cd9d1d Move packages out of deprecated pkg directory
This creates a new `model` directory and moves all data-model related
packages over there:
  exemplar labels relabel rulefmt textparse timestamp value

All the others are more or less utilities and have been moved to `util`:
  gate logging modetimevfs pool runtime

Signed-off-by: beorn7 <beorn@grafana.com>
2021-11-09 08:03:10 +01:00