Conversation
vigo
commented
Mar 25, 2026
- implement avokado and errors package
- add badges
There was a problem hiding this comment.
Pull request overview
Introduces the initial avokado Fiber server builder and an avoerror package for typed API errors, along with repository/CI scaffolding (lint/test workflows, pre-commit, badges, and community files).
Changes:
- Add
avokadoserver constructor with functional options and a built-in/healthzroute. - Add
avoerrorpackage with fluent error builder + tests. - Add CI (lint/tests + coverage upload), repo metadata/config (golangci, pre-commit, badges, CODEOWNERS, license, CoC).
Reviewed changes
Copilot reviewed 13 out of 15 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
| go.mod | Defines module + Go version + dependencies. |
| go.sum | Adds dependency checksums. |
| avokado.go | Implements server builder/options, listen/shutdown, and health endpoint. |
| avoerror/avoerror.go | Adds typed API error type + fluent helpers. |
| avoerror/avoerror_test.go | Adds tests for error behavior and constants. |
| README.md | Adds badges and basic project description. |
| .github/workflows/go-test.yml | Adds Go build/test + coverage upload workflow. |
| .github/workflows/go-lint.yml | Adds golangci-lint workflow. |
| .golangci.yml | Configures linters/formatters. |
| .pre-commit-config.yaml | Adds pre-commit hooks for Go. |
| .gitignore | Adds Go-specific ignore rules. |
| LICENSE | Adds MIT license. |
| CODE_OF_CONDUCT.md | Adds Contributor Covenant CoC. |
| .github/CODEOWNERS | Adds default code owner. |
| .bumpversion.toml | Adds version bump configuration. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| config *config | ||
| } | ||
|
|
||
| // ListenAndServe starts fiber server with grafeful shutdown. |
There was a problem hiding this comment.
Typo in comment: "grafeful" should be "graceful".
| // ListenAndServe starts fiber server with grafeful shutdown. | |
| // ListenAndServe starts fiber server with graceful shutdown. |
| if d < 0 { | ||
| return errors.New("fix this") | ||
| // return fmt.Errorf( | ||
| // "[webhookserver.WithIdleTimeout] error: [%w, '%s' received, must > 0]", | ||
| // cerrors.ErrInvalid, d, | ||
| // ) | ||
| } |
There was a problem hiding this comment.
This option currently returns errors.New("fix this") for invalid input and includes commented-out code. Replace the placeholder with a specific, stable error (ideally a package-level sentinel) and remove the dead commented block so callers get actionable feedback.
| if d < 0 { | ||
| return errors.New("fix this") | ||
| // return fmt.Errorf( | ||
| // "[webhookserver.WithReadTimeout] error: [%w, '%s' received, must > 0]", | ||
| // cerrors.ErrInvalid, d, | ||
| // ) | ||
| } |
There was a problem hiding this comment.
This option currently returns errors.New("fix this") for invalid input and includes commented-out code. Replace the placeholder with a specific, stable error (ideally a package-level sentinel) and remove the dead commented block so callers get actionable feedback.
|
|
||
| var target *avoerror.Error | ||
| if !errors.As(wrapped, &target) { | ||
| t.Fatal("errors.As should find *avokadoerror.Error in chain") |
There was a problem hiding this comment.
The failure message references *avokadoerror.Error, but the type under test is *avoerror.Error. This makes the test output misleading when it fails.
| t.Fatal("errors.As should find *avokadoerror.Error in chain") | |
| t.Fatal("errors.As should find *avoerror.Error in chain") |
|  | ||
|  |
There was a problem hiding this comment.
The two workflow badges appear swapped: the "Go Build Status" badge points to go-lint.yml, and the "GolangCI-Lint Status" badge points to go-test.yml. Update the labels or URLs so each badge matches the workflow it represents.
|  | |
|  | |
|  | |
|  |
| if cfg.serverAPIprefix == "" { | ||
| cfg.serverAPIprefix = "/api/v1" | ||
| } |
There was a problem hiding this comment.
serverAPIprefix is configurable (option + default) but never used when registering routes or grouping handlers, so it currently has no effect and may confuse API consumers. Either apply it (e.g., mount a group under the prefix) or remove it until it's supported.
|
|
||
| select { | ||
| case <-ctx.Done(): | ||
| return s.App.ShutdownWithContext(context.Background()) |
There was a problem hiding this comment.
ListenAndServe triggers shutdown using context.Background(), which drops cancellation/deadline information from the incoming context. Prefer deriving a shutdown context (often with a timeout) from ctx so shutdown can be bounded and responds to cancellation appropriately.
| return s.App.ShutdownWithContext(context.Background()) | |
| shutdownTimeout := s.config.idleTimeout | |
| if shutdownTimeout <= 0 { | |
| shutdownTimeout = defaultIdleTimeout | |
| } | |
| shutdownCtx, cancel := context.WithTimeout(ctx, shutdownTimeout) | |
| defer cancel() | |
| return s.App.ShutdownWithContext(shutdownCtx) |
| if d < 0 { | ||
| return errors.New("fix this") | ||
| // return fmt.Errorf( | ||
| // "[webhookserver.WithReadTimeout] error: [%w, '%s' received, must > 0]", | ||
| // cerrors.ErrInvalid, d, | ||
| // ) | ||
| } |
There was a problem hiding this comment.
This option currently returns errors.New("fix this") for invalid input and includes commented-out code. Replace the placeholder with a specific, stable error (ideally a package-level sentinel) and remove the dead commented block so callers get actionable feedback.
|
|
||
| # avokado | ||
|
|
||
| Quick rest api server genarator for nerds! Includes: |
There was a problem hiding this comment.
Spelling/grammar: "genarator" → "generator".
| Quick rest api server genarator for nerds! Includes: | |
| Quick rest api server generator for nerds! Includes: |
| } | ||
|
|
||
| fiberCfg := *cfg.fiberConfig | ||
| fiberCfg.AppName = cfg.serverName |
There was a problem hiding this comment.
idleTimeout/readTimeout/writeTimeout are configured (and have options/defaults) but never applied to the Fiber config before creating the app, so the options currently have no effect. Wire these values into fiberCfg (or the appropriate listen/server config fields) prior to fiber.New.
| fiberCfg.AppName = cfg.serverName | |
| fiberCfg.AppName = cfg.serverName | |
| fiberCfg.IdleTimeout = cfg.idleTimeout | |
| fiberCfg.ReadTimeout = cfg.readTimeout | |
| fiberCfg.WriteTimeout = cfg.writeTimeout |
Welcome to Codecov 🎉Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests. ℹ️ You can also turn on project coverage checks and project coverage reporting on Pull Request comment Thanks for integrating Codecov - We've got you covered ☂️ |