
Research
Security News
The Landscape of Malicious Open Source Packages: 2025 Mid‑Year Threat Report
A look at the top trends in how threat actors are weaponizing open source packages to deliver malware and persist across the software supply chain.
github.com/naivary/api-layout
This is an api-layout which can be used to implement a RESTful API in Go. The layout is suggesting tools and methods to be used based on best pratices but is allowing to expand however the user likes it.
The following list states the requirements which are gradually implemented in the api-layout.
Handling errors in a HandlerFunc
is challenging. One can't follow the usual
pattern in Go which is to return the error from the function. Having this type
of behavior for the HandlerFunc
too would be really convenient which is why
the api-layout is introducing the type HandlerFuncErr func(w http.ResponseWriter, r *http.Request) error
type. You may know this type from frameworks like echo.
Having this type allows for the usual pattern of Go.
Another challenge is the actual error type. HTTP services return different type
of errors compared to usual Go functions. For example HTTP services have to
return a status code to inform the client how the request went. Fortunately Go
is allowing to easily introduce your own error type. This feature is used to
introduce the HTTPError
which is a specific error type for HTTP services.
Introcducing both of the types don't change the fact that errors have to be
reported back to client using some kind of http response. Using the
HandlerFuncErr
type allows to implement a custom error handler for all the
registered endpoints.
Ideally all routes of an API can be overseen in one file. Which the update of http multiplexer in the standard library it can be used for complex routing. The api-layout is using the standard library and is allowing to define all the routes
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A look at the top trends in how threat actors are weaponizing open source packages to deliver malware and persist across the software supply chain.
Security News
ESLint now supports HTML linting with 48 new rules, expanding its language plugin system to cover more of the modern web development stack.
Security News
CISA is discontinuing official RSS support for KEV and cybersecurity alerts, shifting updates to email and social media, disrupting automation workflows.