go-problemdetails alternatives and similar packages
Based on the "Utilities" category.
Alternatively, view go-problemdetails alternatives based on common mentions on social networks and blogs.
-
项目文档
基于vite+vue3+gin搭建的开发基础平台(支持TS,JS混用),集成jwt鉴权,权限管理,动态路由,显隐可控组件,分页封装,多点登录拦截,资源权限,上传下载,代码生成器,表单生成器,chatGPT自动查表等开发必备功能。 -
excelize
Go language library for reading and writing Microsoft Excel™ (XLAM / XLSM / XLSX / XLTM / XLTX) spreadsheets -
goreleaser
Deliver Go binaries as fast and easily as possible -
godotenv
A Go port of Ruby's dotenv library (Loads environment variables from .env files) -
godropbox
Common libraries for writing Go services/applications. -
hystrix-go
Netflix's Hystrix latency and fault tolerance library, for Go -
Kopia
Cross-platform backup tool for Windows, macOS & Linux with fast, incremental backups, client-side end-to-end encryption, compression and data deduplication. CLI and GUI included. -
go-funk
A modern Go utility library which provides helpers (map, find, contains, filter, ...) -
gorequest
GoRequest -- Simplified HTTP client ( inspired by nodejs SuperAgent ) -
goreporter
A Golang tool that does static analysis, unit testing, code review and generate code quality report. -
lancet
A comprehensive, efficient, and reusable util function library of Go. -
gojson
Automatically generate Go (golang) struct definitions from example JSON -
create-go-app
✨ A complete and self-contained solution for developers of any qualification to create a production-ready project with backend (Go), frontend (JavaScript, TypeScript) and deploy automation (Ansible, Docker) by running only one CLI command. -
spinner
Go (golang) package with 90 configurable terminal spinner/progress indicators. -
EaseProbe
A simple, standalone, and lightweight tool that can do health/status checking, written in Go. -
filetype
Fast, dependency-free Go package to infer binary file types based on the magic numbers header signature -
grequests
A Go "clone" of the great and famous Requests library -
boilr
:zap: boilerplate template manager that generates files or directories from template repositories -
sling
A Go HTTP client library for creating and sending API requests -
mole
CLI application to create ssh tunnels focused on resiliency and user experience. -
beaver
💨 A real time messaging system to build a scalable in-app notifications, multiplayer games, chat apps in web and mobile apps. -
mimetype
A fast Golang library for media type and file extension detection, based on magic numbers -
go-underscore
Helpfully Functional Go - A useful collection of Go utilities. Designed for programmer happiness. -
gentleman
Plugin-driven, extensible HTTP client toolkit for Go -
JobRunner
Framework for performing work asynchronously, outside of the request flow -
git-time-metric
Simple, seamless, lightweight time tracking for Git
Free Global Payroll designed for tech teams
Do you think we are missing an alternative of go-problemdetails or a related project?
Popular Comparisons
README
Golang Problem Details
Problem details implementation (https://tools.ietf.org/html/rfc7807) package for go.
go get github.com/mvmaasakkers/go-problemdetails
How to use
The ProblemDetails
struct can be used as error
because it implements the error
interface. The ProblemType
interface can be used to create predefined ProblemDetails
with extensions and also implements the error
interface.
The struct is setup to be used by the json and
xml marshaler from the stdlib and will marshal into application/problem+json
or application/problem+xml
compliant data as defined in the RFC 7807.
To generate a ProblemDetails
based on just a HTTP Status Code you can create one using NewHTTP(statusCode int)
:
problemDetails := problemdetails.NewHTTP(http.StatusNotFound)
This will generate a ProblemDetails
struct that marshals as follows:
{
"type": "about:blank",
"title": "Not Found",
"status": 404
}
<problem xmlns="urn:ietf:rfc:7807">
<type>about:blank</type>
<title>Not Found</title>
<status>404</status>
</problem>
or use the more verbose New(statusCode int, problemType, title, detail, instance string)
:
problemDetails := problemdetails.New(http.StatusNotFound, "https://example.net/problem/object_not_found", "Object not found", "Object with id 1234 was not found, another id should be given.", "https://api.example.net/objects/1234")
This will generate a ProblemDetails
struct that marshals as follows:
{
"type": "https://example.net/problem/object_not_found",
"title": "Object not found",
"status": 404,
"detail": "Object with id 1234 was not found, another id should be given.",
"instance": "https://api.example.net/objects/1234"
}
<problem xmlns="urn:ietf:rfc:7807">
<type>https://example.net/problem/object_not_found</type>
<title>Object not found</title>
<status>404</status>
<detail>Object with id 1234 was not found, another id should be given.</detail>
<instance>https://api.example.net/objects/1234</instance>
</problem>
Http helpers
For ease of use there are two output handlers available. ProblemDetails.ServeJSON
for JSON and ProblemDetails.ServeXML
for XML.
A shorthand for generating a 404 statuscode in Problem Details JSON to the ResponseWriter you can:
problemdetails.NewHTTP(http.StatusNotFound).ServeJSON(w, r)
*Note that all licence references and agreements mentioned in the go-problemdetails README section above
are relevant to that project's source code only.