Merge pull request 'chore: fix CI workflow, golangci-lint config, and minor lint/format issues' (#92) from muel/gitlink-cli:chore/test-coverage-and-lint into master
This commit is contained in:
commit
687633d22f
|
|
@ -8,23 +8,23 @@ on:
|
|||
|
||||
jobs:
|
||||
check:
|
||||
name: Build, Test, Vet
|
||||
name: Build, Lint, Test
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '1.22'
|
||||
|
||||
- name: Build
|
||||
run: go build ./...
|
||||
|
||||
- name: Test
|
||||
run: go test -race ./...
|
||||
- name: Lint
|
||||
run: make lint
|
||||
|
||||
- name: Vet
|
||||
run: go vet ./...
|
||||
- name: Test
|
||||
run: make test
|
||||
|
||||
- name: Check formatting
|
||||
run: |
|
||||
unformatted=$(gofmt -s -l .)
|
||||
if [ -n "$unformatted" ]; then
|
||||
echo "Files not formatted:"
|
||||
echo "$unformatted"
|
||||
exit 1
|
||||
fi
|
||||
run: make fmt
|
||||
|
|
|
|||
|
|
@ -45,6 +45,9 @@ linters:
|
|||
# Best-effort output rendering
|
||||
- linters: [errcheck]
|
||||
path: render\.go$
|
||||
# errcheck: test helpers intentionally ignore return values
|
||||
- linters: [errcheck]
|
||||
path: _test\.go$
|
||||
# errorlint: type assertions are fine in tests
|
||||
- linters: [errorlint]
|
||||
path: _test\.go$
|
||||
|
|
|
|||
|
|
@ -179,13 +179,13 @@ func TestRepoCreate(t *testing.T) {
|
|||
func TestRepoCreateWithOptions(t *testing.T) {
|
||||
var body map[string]interface{}
|
||||
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
switch {
|
||||
case r.URL.Path == "/users/me.json":
|
||||
switch r.URL.Path {
|
||||
case "/users/me.json":
|
||||
writeJSON(w, map[string]interface{}{
|
||||
"login": "creator",
|
||||
"user_id": float64(42),
|
||||
})
|
||||
case r.URL.Path == "/creator/my-repo.json":
|
||||
case "/creator/my-repo.json":
|
||||
json.NewDecoder(r.Body).Decode(&body)
|
||||
writeJSON(w, map[string]interface{}{"name": "my-repo"})
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -156,4 +156,3 @@ func TestRecommendedAction(t *testing.T) {
|
|||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue