Help us shape the future of Go! Take the 2026 Go Developer Survey

problem

package
v0.1.0-rc.41 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 22, 2026 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Overview

Package problemtype defines canonical API problem type URIs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HelpURL

func HelpURL(code, caseID string) string

HelpURL adds only known, non-sensitive context; the problem type stays canonical.

func Is

func Is(problemURI, code string) bool

Is compares a problem URI to an identifier without duplicating URI spelling.

func NewRequestID

func NewRequestID() string

func URL

func URL(code string) string

URL returns the URI for an API problem code or private problem identifier.

func Write

func Write(response http.ResponseWriter, status int, code, title, detail string, caseID ...string) string

Write sends an authored problem once and returns the ID for operational logs.

Types

type Problem

type Problem struct {
	Type      string         `json:"type"`
	Title     string         `json:"title"`
	Status    int            `json:"status"`
	Code      string         `json:"code"`
	Detail    string         `json:"detail"`
	RequestID string         `json:"request_id"`
	Details   map[string]any `json:"details"`
}

Problem is the shared HTTP error envelope. an API owns its allowed codes, while this writer owns the fields and request correlation across services.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL