Re-vendor the shared files from sneak/prompts at dd4027b (closes #52)
check / check (push) Canceled after 0s
check / check (push) Canceled after 0s
Takes .golangci.yml, .dockerignore, .gitignore, .editorconfig, the workflow and REPO_POLICIES.md from sneak/prompts dd4027b, keeping this repository's own entries after the shared content. Lint (golangci-lint v2.14.0) and test become Dockerfile phases that script/lint and script/test build alone and uncached; the image build depends on both, and script/cibuild bootstraps, runs script/check, then builds the image. The agent guidance file moves to AGENTS.md. The Go code is fixed for what the new configuration finds; reads that iterate rows now also report an iteration error. Model: opus-5-5
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
// Package ristypes defines the data structures for RIS Live BGP messages and announcements.
|
||||
// Package ristypes defines the data structures for RIS Live BGP messages and
|
||||
// announcements.
|
||||
package ristypes
|
||||
|
||||
import (
|
||||
@@ -17,25 +18,30 @@ type ASPath []int
|
||||
func (p *ASPath) UnmarshalJSON(data []byte) error {
|
||||
// First try to unmarshal as a simple array of integers
|
||||
var simple []int
|
||||
if err := json.Unmarshal(data, &simple); err == nil {
|
||||
|
||||
err := json.Unmarshal(data, &simple)
|
||||
if err == nil {
|
||||
*p = ASPath(simple)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// If that fails, unmarshal as array of interfaces and flatten
|
||||
var raw []interface{}
|
||||
if err := json.Unmarshal(data, &raw); err != nil {
|
||||
var raw []any
|
||||
|
||||
err = json.Unmarshal(data, &raw)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Flatten the array
|
||||
result := make([]int, 0)
|
||||
|
||||
for _, item := range raw {
|
||||
switch v := item.(type) {
|
||||
case float64:
|
||||
result = append(result, int(v))
|
||||
case []interface{}:
|
||||
case []any:
|
||||
// Nested array - flatten it
|
||||
for _, nested := range v {
|
||||
if num, ok := nested.(float64); ok {
|
||||
@@ -62,6 +68,8 @@ type RISLiveMessage struct {
|
||||
// It contains metadata about the BGP session (peer, ASN, host) along with
|
||||
// the actual BGP update data including AS path, communities, announcements,
|
||||
// and withdrawals.
|
||||
//
|
||||
//nolint:tagliatelle // field names are the RIS Live feed's
|
||||
type RISMessage struct {
|
||||
Type string `json:"type"`
|
||||
Timestamp float64 `json:"timestamp"`
|
||||
@@ -90,6 +98,8 @@ type RISMessage struct {
|
||||
// RISAnnouncement represents a BGP route announcement within a RIS message.
|
||||
// It contains the next hop IP address and the list of prefixes being announced
|
||||
// via that next hop.
|
||||
//
|
||||
//nolint:tagliatelle // field names are the RIS Live feed's
|
||||
type RISAnnouncement struct {
|
||||
NextHop string `json:"next_hop"`
|
||||
Prefixes []string `json:"prefixes"`
|
||||
|
||||
Reference in New Issue
Block a user