Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Copilot Instructions for `goark/fetch`

## Project purpose

`fetch` is a small package focused on downloading data from URL endpoints.
The package should hide common `net/http` idioms and keep calling code simple.

## Design principles

- Prefer explicit, small APIs over feature-rich abstractions.
- Keep `context.Context` based methods as the default path.
- Favor composable option functions (`ClientOpts`, `RequestOpts`).
- Preserve compatibility when possible; avoid breaking public symbols.

## Error handling

- Use `github.com/goark/errs` as the primary internal error handling package.
- Prefer `errs.Wrap`, `errs.Join`, and `errs.WithContext` over ad-hoc wrapping patterns.
- Keep `errors.Is` compatibility when returning wrapped errors.
- Return wrapped errors so callers can use `errors.Is`.
- Keep sentinel errors stable (`ErrInvalidURL`, `ErrInvalidRequest`, `ErrHTTPStatus`, `ErrNullPointer`).
- Include useful context values when wrapping errors.

## HTTP behavior

- Continue to use `net/http` as the base implementation.
- Ensure response body cleanup remains safe and predictable.
- Keep behavior for non-success HTTP status explicit and documented.

## Coding style

- Write idiomatic Go and keep implementation straightforward.
- Avoid unnecessary dependencies.
- Keep comments concise and in English.

## Testing and validation

- Add or update tests for behavior changes.
- Prefer local validation with Taskfile targets:
- `task test`
- `task govulncheck`

## Documentation

- Keep `README.md` in sync with public API changes.
- Include practical examples for GET/POST and error handling.
44 changes: 44 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: ci

on:
push:
branches:
- main
pull_request:

permissions:
contents: read

jobs:
test-and-lint:
name: lint and test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6

- uses: actions/setup-go@v6
with:
go-version-file: go.mod
cache-dependency-path: go.sum

- name: golangci-lint
uses: golangci/golangci-lint-action@v9
with:
version: latest
args: --enable gosec

- name: Test module
run: go test -shuffle on ./...

govulncheck:
name: govulncheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6

- name: Run govulncheck
uses: golang/govulncheck-action@v1
with:
go-version-file: go.mod
go-package: ./...
repo-checkout: false
61 changes: 0 additions & 61 deletions .github/workflows/codeql-analysis.yml

This file was deleted.

35 changes: 35 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: CodeQL

on:
push:
branches:
- main
pull_request:
branches:
- main
schedule:
- cron: "0 20 * * 0"

permissions:
actions: read
contents: read
security-events: write

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6

- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: go

- name: Autobuild
uses: github/codeql-action/autobuild@v3

- name: Perform CodeQL analysis
uses: github/codeql-action/analyze@v3
50 changes: 0 additions & 50 deletions .github/workflows/lint.yml

This file was deleted.

19 changes: 0 additions & 19 deletions .github/workflows/vulns.yml

This file was deleted.

Loading
Loading