Skip to content

Conversation

@AlexisMontagne
Copy link
Member

What does this PR do?

Inspired by a discussion i had with @tgallice, i played a bit around with a LLM to improve the documentation, in a few prompt how can we get some doucmentation that could be both helpful for the lib users and and the lib author (having example that can be verified by the tests in the CI).

What are the observable changes?

Good PR checklist

  • Title makes sense
  • Is against the correct branch
  • Only addresses one issue
  • Properly assigned
  • Added/updated tests
  • Added/updated documentation
  • Properly labeled

Additional Notes


func (e MyError) Error() string { return e.message }

type MyErrorWithCode struct {

Choose a reason for hiding this comment

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

🚫 [golangci] reported by reviewdog 🐶
the error type name MyErrorWithCode should conform to the XxxError format (errname)

// Create an error and attach a domain for categorization
err := errors.New("operation failed")
errWithDomain := errors.WithDomain(err, "database")

Choose a reason for hiding this comment

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

🚫 [golangci] reported by reviewdog 🐶
File is not properly formatted (gofmt)

func ExampleOpaque() {
// Create an internal error that we want to hide
internalErr := errors.New("database connection pool exhausted")

Choose a reason for hiding this comment

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

🚫 [golangci] reported by reviewdog 🐶
File is not properly formatted (gofmt)

// Create an error and attach a status
err := errors.New("request processing failed")
errWithStatus := errors.WithStatus(err, "failed")

Choose a reason for hiding this comment

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

🚫 [golangci] reported by reviewdog 🐶
File is not properly formatted (gofmt)


func ExampleWithTags() {
userID := "user123"

Choose a reason for hiding this comment

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

🚫 [golangci] reported by reviewdog 🐶
File is not properly formatted (gofmt)

"github.com/upfluence/errors/base"
)

// Statuser provides a custom status string for an error.

Choose a reason for hiding this comment

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

🚫 [golangci] reported by reviewdog 🐶
Statuser is a misspelling of Stature (misspell)

// GetStatus extracts a status string from an error.
// Returns the success status string if err is nil.
// Traverses the error chain looking for a Status() method,
// falling back to the configured Statuser if none is found.

Choose a reason for hiding this comment

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

🚫 [golangci] reported by reviewdog 🐶
Statuser is a misspelling of Stature (misspell)


func Cause(err error) error { return base.UnwrapAll(err) }
// Cause returns the root cause of an error by recursively unwrapping it.
func Cause(err error) error { return base.UnwrapAll(err) }

Choose a reason for hiding this comment

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

🚫 [golangci] reported by reviewdog 🐶
error returned from external package is unwrapped: sig: func github.com/upfluence/errors/base.UnwrapAll(err error) error (wrapcheck)

if input < 0 {
return Result{}, fmt.Errorf("negative input not allowed")
}
return Result{Value: input * 2}, nil

Choose a reason for hiding this comment

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

🚫 [golangci] reported by reviewdog 🐶
return with no blank line before (nlreturn)

@AlexisMontagne AlexisMontagne merged commit 9c12d9c into master Nov 24, 2025
4 of 5 checks passed
@AlexisMontagne AlexisMontagne deleted the am/doc branch November 24, 2025 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants