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

hello

package
v0.18.3 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package hello is a minimal GoRun extension speaking the HTTP bridge protocol (docs/EXTENSIONS.md). It verifies every delivery's HMAC signature, logs actions and events, and implements one filter: content.before_save appends " — via hello" to the title.

It uses only the standard library on purpose: it is what a third-party extension written in Go looks like. Run it with

HELLO_SECRET=<secret shown at install> go run ./examples/extensions/hello-http/cmd/hello-http

GoRun's tests mount Handler behind httptest.

Index

Constants

View Source
const Suffix = " — via hello"

Suffix is what the content.before_save filter appends to titles.

Variables

This section is empty.

Functions

This section is empty.

Types

type Delivery

type Delivery struct {
	Hook       string          `json:"hook"`
	Kind       string          `json:"kind"`
	Payload    json.RawMessage `json:"payload"`
	Site       json.RawMessage `json:"site"`
	TS         int64           `json:"ts"`
	DeliveryID string          `json:"delivery_id"`
}

Delivery is one verified bridge request.

type Server

type Server struct {
	Log *slog.Logger
	// contains filtered or unexported fields
}

Server is the extension's HTTP handler.

func Handler

func Handler(secret string) *Server

Handler returns the extension handler verifying deliveries with secret (the HMAC secret GoRun shows once at install).

func (*Server) Events

func (s *Server) Events() []Delivery

Events returns the verified action/event deliveries received so far.

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP handles one bridge delivery.

func (*Server) SetSecret

func (s *Server) SetSecret(secret string)

SetSecret replaces the HMAC secret (e.g. after reinstalling).

Directories

Path Synopsis
cmd
hello-http command
Command hello-http runs the hello example extension:
Command hello-http runs the hello example extension:

Jump to

Keyboard shortcuts

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