mirror of
https://github.com/zap-proto/zip.git
synced 2026-10-19 15:38:57 +00:00
zip is shared protocol infra (the fiber-over-ZAP web framework used by every
Lux/Hanzo/Zoo Go binary — nodes, gateway, cloud, iam, kms, o11y, ai, …), so its
home is the ZAP protocol family (zap-proto/{go,http,zapd,zip}), NOT any one org's
brand namespace. This consolidates the rich framework (formerly hanzoai/zip v0.5.0
— Ctx/Handler/Errorf/Err*/HTTPError, typed handlers, middleware, runtime/extension
loading, openapi, validate, zaprpc) with the real ZAP transport (ListenZAP/
ListenHTTP/Serve over zap-proto/http) into ONE canonical module.
Module path github.com/hanzoai/zip -> github.com/zap-proto/zip. Code identical to
hanzoai/zip v0.5.0; promoted to v1.0.0 as the stable shared-infra framework. The
prior hanzoai/zip lineage is retired — one home, one import path, one way.
Verified: go build/vet/test ./... green; the ZAP round-trip integration test serves
/v1/health over the real ZAP transport (200 + handler JSON).
21 lines
704 B
Go
21 lines
704 B
Go
//go:build !goexperiment.jsonv2
|
|
|
|
package jsonenc
|
|
|
|
import (
|
|
"encoding/json"
|
|
)
|
|
|
|
// Variant reports which JSON implementation backs this build. v2 is
|
|
// reachable only under `GOEXPERIMENT=jsonv2`; without that flag the
|
|
// stdlib encoding/json/v2 import does not resolve at compile time and
|
|
// zip falls back to encoding/json v1. zip.New() logs Variant once at
|
|
// startup so operators can spot a missing GOEXPERIMENT in CI.
|
|
const Variant = "encoding/json"
|
|
|
|
// Marshal encodes v as JSON via encoding/json (v1).
|
|
func Marshal(v any) ([]byte, error) { return json.Marshal(v) }
|
|
|
|
// Unmarshal decodes data into v via encoding/json (v1).
|
|
func Unmarshal(data []byte, v any) error { return json.Unmarshal(data, v) }
|