Skip to content

work#1

Open
vigo wants to merge 48 commits into
mainfrom
work
Open

work#1
vigo wants to merge 48 commits into
mainfrom
work

Conversation

@vigo

@vigo vigo commented Mar 25, 2026

Copy link
Copy Markdown
Contributor
  • implement avokado and errors package
  • add badges

Copilot AI review requested due to automatic review settings March 25, 2026 19:46

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 avokado server constructor with functional options and a built-in /healthz route.
  • Add avoerror package 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.

Comment thread avokado.go Outdated
config *config
}

// ListenAndServe starts fiber server with grafeful shutdown.

Copilot AI Mar 25, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in comment: "grafeful" should be "graceful".

Suggested change
// ListenAndServe starts fiber server with grafeful shutdown.
// ListenAndServe starts fiber server with graceful shutdown.

Copilot uses AI. Check for mistakes.
Comment thread avokado.go
Comment on lines +158 to +164
if d < 0 {
return errors.New("fix this")
// return fmt.Errorf(
// "[webhookserver.WithIdleTimeout] error: [%w, '%s' received, must > 0]",
// cerrors.ErrInvalid, d,
// )
}

Copilot AI Mar 25, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment thread avokado.go
Comment on lines +191 to +197
if d < 0 {
return errors.New("fix this")
// return fmt.Errorf(
// "[webhookserver.WithReadTimeout] error: [%w, '%s' received, must > 0]",
// cerrors.ErrInvalid, d,
// )
}

Copilot AI Mar 25, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment thread avoerror/avoerror_test.go

var target *avoerror.Error
if !errors.As(wrapped, &target) {
t.Fatal("errors.As should find *avokadoerror.Error in chain")

Copilot AI Mar 25, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The failure message references *avokadoerror.Error, but the type under test is *avoerror.Error. This makes the test output misleading when it fails.

Suggested change
t.Fatal("errors.As should find *avokadoerror.Error in chain")
t.Fatal("errors.As should find *avoerror.Error in chain")

Copilot uses AI. Check for mistakes.
Comment thread README.md Outdated
Comment on lines +4 to +5
![Go Build Status](https://github.com/bilustek/avokado/actions/workflows/go-lint.yml/badge.svg)
![GolangCI-Lint Status](https://github.com/bilustek/avokado/actions/workflows/go-test.yml/badge.svg)

Copilot AI Mar 25, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
![Go Build Status](https://github.com/bilustek/avokado/actions/workflows/go-lint.yml/badge.svg)
![GolangCI-Lint Status](https://github.com/bilustek/avokado/actions/workflows/go-test.yml/badge.svg)
![Go Build Status](https://github.com/bilustek/avokado/actions/workflows/go-test.yml/badge.svg)
![GolangCI-Lint Status](https://github.com/bilustek/avokado/actions/workflows/go-lint.yml/badge.svg)

Copilot uses AI. Check for mistakes.
Comment thread avokado.go
Comment on lines +224 to +226
if cfg.serverAPIprefix == "" {
cfg.serverAPIprefix = "/api/v1"
}

Copilot AI Mar 25, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment thread avokado.go Outdated

select {
case <-ctx.Done():
return s.App.ShutdownWithContext(context.Background())

Copilot AI Mar 25, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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)

Copilot uses AI. Check for mistakes.
Comment thread avokado.go
Comment on lines +174 to +180
if d < 0 {
return errors.New("fix this")
// return fmt.Errorf(
// "[webhookserver.WithReadTimeout] error: [%w, '%s' received, must > 0]",
// cerrors.ErrInvalid, d,
// )
}

Copilot AI Mar 25, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment thread README.md Outdated

# avokado

Quick rest api server genarator for nerds! Includes:

Copilot AI Mar 25, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spelling/grammar: "genarator" → "generator".

Suggested change
Quick rest api server genarator for nerds! Includes:
Quick rest api server generator for nerds! Includes:

Copilot uses AI. Check for mistakes.
Comment thread avokado.go
}

fiberCfg := *cfg.fiberConfig
fiberCfg.AppName = cfg.serverName

Copilot AI Mar 25, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
fiberCfg.AppName = cfg.serverName
fiberCfg.AppName = cfg.serverName
fiberCfg.IdleTimeout = cfg.idleTimeout
fiberCfg.ReadTimeout = cfg.readTimeout
fiberCfg.WriteTimeout = cfg.writeTimeout

Copilot uses AI. Check for mistakes.
@sentry

sentry Bot commented Mar 25, 2026

Copy link
Copy Markdown

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 ☂️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants