diff options
| author | 2025-09-18 16:48:45 +0200 | |
|---|---|---|
| committer | 2025-09-18 16:48:45 +0200 | |
| commit | 82216281cee085771fa86173cdf6af6487e48512 (patch) | |
| tree | 33311c5469783d10e8b25dc006c148f8def8cfeb /vendor/codeberg.org/gruf/go-bitutil/flag.tpl | |
| parent | [feature] add paging support to rss feed endpoint, and support JSON / atom fe... (diff) | |
| download | gotosocial-82216281cee085771fa86173cdf6af6487e48512.tar.xz | |
[chore/docs] Fix Prometheus metric names for Gin, include example Grafana dash, update docs (#4443)v0.20.0-rc1
# Description
> If this is a code change, please include a summary of what you've coded, and link to the issue(s) it closes/implements.
>
> If this is a documentation change, please briefly describe what you've changed and why.
This pull request updates some of our inconsistent metric naming, and adds an example Grafana dashboard using all the most up-to-date metrics names, and updates our docs to describe the latest way of setting up metrics.
Closes https://codeberg.org/superseriousbusiness/gotosocial/issues/4362
Closes https://codeberg.org/superseriousbusiness/gotosocial/issues/4055
## Checklist
Please put an x inside each checkbox to indicate that you've read and followed it: `[ ]` -> `[x]`
If this is a documentation change, only the first checkbox must be filled (you can delete the others if you want).
- [x] I/we have read the [GoToSocial contribution guidelines](https://codeberg.org/superseriousbusiness/gotosocial/src/branch/main/CONTRIBUTING.md).
- [x] I/we have discussed the proposed changes already, either in an issue on the repository, or in the Matrix chat.
- [x] I/we have not leveraged AI to create the proposed changes.
- [x] I/we have performed a self-review of added code.
- [x] I/we have written code that is legible and maintainable by others.
- [x] I/we have commented the added code, particularly in hard-to-understand areas.
- [x] I/we have made any necessary changes to documentation.
- [ ] I/we have added tests that cover new code.
- [x] I/we have run tests and they pass locally with the changes.
- [x] I/we have run `go fmt ./...` and `golangci-lint run`.
Co-authored-by: kim <grufwub@gmail.com>
Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4443
Reviewed-by: kim <gruf@noreply.codeberg.org>
Co-authored-by: tobi <tobi.smethurst@protonmail.com>
Co-committed-by: tobi <tobi.smethurst@protonmail.com>
Diffstat (limited to 'vendor/codeberg.org/gruf/go-bitutil/flag.tpl')
| -rw-r--r-- | vendor/codeberg.org/gruf/go-bitutil/flag.tpl | 117 |
1 files changed, 0 insertions, 117 deletions
diff --git a/vendor/codeberg.org/gruf/go-bitutil/flag.tpl b/vendor/codeberg.org/gruf/go-bitutil/flag.tpl deleted file mode 100644 index ac00bfa97..000000000 --- a/vendor/codeberg.org/gruf/go-bitutil/flag.tpl +++ /dev/null @@ -1,117 +0,0 @@ -package bitutil - -import ( - "strings" - "unsafe" -) - -{{ range $idx, $size := . }} - -// Flags{{ $size.Size }} is a type-casted unsigned integer with helper -// methods for easily managing up to {{ $size.Size }} bit-flags. -type Flags{{ $size.Size }} uint{{ $size.Size }} - -// Get will fetch the flag bit value at index 'bit'. -func (f Flags{{ $size.Size }}) Get(bit uint8) bool { - mask := Flags{{ $size.Size }}(1) << bit - return (f & mask != 0) -} - -// Set will set the flag bit value at index 'bit'. -func (f Flags{{ $size.Size }}) Set(bit uint8) Flags{{ $size.Size }} { - mask := Flags{{ $size.Size }}(1) << bit - return f | mask -} - -// Unset will unset the flag bit value at index 'bit'. -func (f Flags{{ $size.Size }}) Unset(bit uint8) Flags{{ $size.Size }} { - mask := Flags{{ $size.Size }}(1) << bit - return f & ^mask -} - -{{ range $idx := $size.Bits }} - -// Get{{ $idx }} will fetch the flag bit value at index {{ $idx }}. -func (f Flags{{ $size.Size }}) Get{{ $idx }}() bool { - const mask = Flags{{ $size.Size }}(1) << {{ $idx }} - return (f & mask != 0) -} - -// Set{{ $idx }} will set the flag bit value at index {{ $idx }}. -func (f Flags{{ $size.Size }}) Set{{ $idx }}() Flags{{ $size.Size }} { - const mask = Flags{{ $size.Size }}(1) << {{ $idx }} - return f | mask -} - -// Unset{{ $idx }} will unset the flag bit value at index {{ $idx }}. -func (f Flags{{ $size.Size }}) Unset{{ $idx }}() Flags{{ $size.Size }} { - const mask = Flags{{ $size.Size }}(1) << {{ $idx }} - return f & ^mask -} - -{{ end }} - -// String returns a human readable representation of Flags{{ $size.Size }}. -func (f Flags{{ $size.Size }}) String() string { - var ( - i int - val bool - buf []byte - ) - - // Make a prealloc est. based on longest-possible value - const prealloc = 1+(len("false ")*{{ $size.Size }})-1+1 - buf = make([]byte, prealloc) - - buf[i] = '{' - i++ - - {{ range $idx := .Bits }} - val = f.Get{{ $idx }}() - i += copy(buf[i:], bool2str(val)) - buf[i] = ' ' - i++ - {{ end }} - - buf[i-1] = '}' - buf = buf[:i] - - return *(*string)(unsafe.Pointer(&buf)) -} - -// GoString returns a more verbose human readable representation of Flags{{ $size.Size }}. -func (f Flags{{ $size.Size }})GoString() string { - var ( - i int - val bool - buf []byte - ) - - // Make a prealloc est. based on longest-possible value - const prealloc = len("bitutil.Flags{{ $size.Size }}{")+(len("{{ sub $size.Size 1 }}=false ")*{{ $size.Size }})-1+1 - buf = make([]byte, prealloc) - - i += copy(buf[i:], "bitutil.Flags{{ $size.Size }}{") - - {{ range $idx := .Bits }} - val = f.Get{{ $idx }}() - i += copy(buf[i:], "{{ $idx }}=") - i += copy(buf[i:], bool2str(val)) - buf[i] = ' ' - i++ - {{ end }} - - buf[i-1] = '}' - buf = buf[:i] - - return *(*string)(unsafe.Pointer(&buf)) -} - -{{ end }} - -func bool2str(b bool) string { - if b { - return "true" - } - return "false" -}
\ No newline at end of file |
