
Security News
US Government Forces Anthropic to Pull Claude Fable Days After Launch
Anthropic says the directive cited national security concerns over a narrow jailbreak, but offered no specific technical details.
jape is a "micro-framework" for building JSON-based HTTP APIs. It includes:
Context type for handlers, with convenient methods for JSON and error handlingimport (
"net/http"
"go.sia.tech/jape"
)
func helloHandler(jc jape.Context) {
var greeting string
if jc.Decode(&greeting) == nil {
jc.Encode(greeting + ", " + jc.PathParam("name"))
}
}
func NewServer() http.Handler {
return jape.Mux(map[string]jape.Handler{
"POST /hello/:name": helloHandler,
})
}
type Client struct {
c jape.Client
}
func (c Client) Hello(name, greeting string) (resp int, err error) {
err = c.c.POST("/hello/"+name, greeting, &resp)
return
}
Did you notice the error in the example code? If we run japecheck, it reports:
example.go:24:43 Client has wrong response type for POST /hello/:name (got int, should be string)
To install japecheck, run go install go.sia.tech/jape/japecheck.
You can then run it as a pre-commit hook like so:
echo -e "#!/usr/bin/env bash\njapecheck ./api" > .git/hooks/pre-commit
chmod +x .git/hooks/pre-commit
To use with action-golang-analysis, create .github/workflows/analyzer.yml in your repository with the following contents:
name: Analyzer
on:
pull_request:
branches: [ master ]
push:
branches: [ master ]
jobs:
analyzer:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
- uses: SiaFoundation/action-golang-analysis@HEAD
with:
analyzers: |
go.sia.tech/jape.Analyzer
It can also be added as a job within your existing workflow, like in renterd.
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.

Security News
Anthropic says the directive cited national security concerns over a narrow jailbreak, but offered no specific technical details.

Security News
A network of 152 Chrome live wallpaper extensions hid ad tracking and made extension-driven traffic look like Google search clicks.

Company News
Socket’s first CISO brings deep experience securing high-growth SaaS companies as open source supply chain threats accelerate.