Compare commits

...

9 commits

Author SHA1 Message Date
Gabriel Augendre
fbf73fbd4d
update badge link to wiki
Some checks failed
Go / build (push) Has been cancelled
golangci-lint / lint (push) Has been cancelled
Go / coverage (push) Has been cancelled
2024-10-30 16:37:48 +01:00
Gabriel Augendre
ed98e56f00
prevent concurrent coverage reports 2024-10-30 16:35:52 +01:00
Gabriel Augendre
7f2b12beab
add coverage badge 2024-10-30 16:29:06 +01:00
Gabriel Augendre
9b1b0c8986
remove unused contrib folder 2024-10-30 16:28:56 +01:00
Gabriel Augendre
1c05d23bb3
fix condition on coverage report job 2024-10-30 16:23:45 +01:00
Gabriel Augendre
e1e94fa7d4
use separate job with specific permissions for coverage report 2024-10-30 16:23:02 +01:00
pre-commit-ci[bot]
db40be2dee [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2024-10-30 16:17:27 +01:00
Gabriel Augendre
0c76b071d6 add coverage report 2024-10-30 16:17:27 +01:00
Gabriel Augendre
cddb074802
add badges in readme 2024-10-30 15:35:31 +01:00
3 changed files with 22 additions and 21 deletions

View file

@ -29,3 +29,21 @@ jobs:
run: go build -v ./...
- name: Test
run: make test
coverage:
name: coverage
permissions:
contents: write
concurrency:
group: coverage
runs-on: ubuntu-latest
needs: [build]
steps:
- name: Update coverage report
uses: ncruces/go-coverage-report@v0
with:
report: true
chart: true
amend: true
if: |
github.event_name == 'push'
continue-on-error: true

View file

@ -1,5 +1,9 @@
# fatcontext
[![Go Reference](https://pkg.go.dev/badge/github.com/Crocmagnon/fatcontext.svg)](https://pkg.go.dev/github.com/Crocmagnon/fatcontext)
[![Go Report Card](https://goreportcard.com/badge/github.com/Crocmagnon/fatcontext)](https://goreportcard.com/report/github.com/Crocmagnon/fatcontext)
[![Go Coverage](https://github.com/Crocmagnon/fatcontext/wiki/coverage.svg)](https://github.com/Crocmagnon/fatcontext/wiki/Coverage)
`fatcontext` is a Go linter which detects potential fat contexts in loops or function literals.
They can lead to performance issues, as documented here: https://gabnotes.org/fat-contexts/

View file

@ -1,21 +0,0 @@
package contrib
import "context"
func ok() {
ctx := context.Background()
for i := 0; i < 10; i++ {
ctx := context.WithValue(ctx, "key", i)
_ = ctx
}
}
func notOk() {
ctx := context.Background()
for i := 0; i < 10; i++ {
ctx = context.WithValue(ctx, "key", i) // "nested context in loop"
_ = ctx
}
}