Repository navigation
Add Go examples to the archival, conventions, rpc, conversions and events guides - #3124
Open
stellar-triage-bot[bot] wants to merge 2 commits into
Open
stellar-triage-bot[bot] wants to merge 2 commits into
stellar-triage-bot[bot] wants to merge 2 commits into
Conversation
Contributor
Author
|
🤖 Automated message from the Stellar Triage Bot. Reviewing my own PR, which the issue lane opened for #1770. Verified: every Go symbol matches go-stellar-sdk v0.9.0 (newest) and GORM v1.31.2. Not run: the Go blocks on all 14 pages, which a maintainer runs before merge. Merge #3115, then #3123, then this PR. Ready to merge. What I checked
|
This was referenced Nov 13, 2026
ElliotFriend
requested changes
Nov 13, 2026
ElliotFriend
left a comment
Contributor
There was a problem hiding this comment.
Every Go block compiles against go-stellar-sdk v0.9.0, passes go vet, and ran on testnet. Conversion outputs match the JavaScript tab exactly. A few fixes before merge:
Code
events/consume.mdx:322:var events []StellarEventredeclareseventsfrom:203when the blocks share onemain(events redeclared in this block). Rename it (for exampleallEvents). The JavaScript tab has the same clash withconst events, so fix it there too.conventions/deploy-sac-with-code.mdx:148: following the comment doesn't compile either way. In a separate file therpcclientimport is unused; pasted into this file, it needserrorsandtime. Say which imports to adjust.conversions/string-conversions.mdx:75: the fragment callslog.Fatalbut doesn't importlog.- Each page's
prepareTransactionasserts one operation type and panics on any other. Add a one-line comment saying so.
Prose and comments
- Oxford comma:
extend-persistent-entry.mdx:36,:203;deploy-sac-with-code.mdx:513;extending-wasm-ttl.mdx:354,:436;address-conversions.mdx:12;events/ingest.mdx:10; and theprepareTransactiondoc comment on every page.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 Automated message from the Stellar Triage Bot.
Refs #1770
Working this because @ElliotFriend approved the Go and Java splits in #1770 and asked me to keep building the stack. This is Go B: Go tabs on the other 14
build/guidespages. Base: #3123 (docs-agent/1770-go-a). Go C, Go D and Java A to D follow.What changed
archival/:create-restoration-footprint,extend-persistent-entry,restore-contract,restore-dataconventions/:deploy-sac-with-code,extending-wasm-ttlrpc/:generate-ledger-keys,retrieve-contract-codeconversions/:address-conversions,bytes-conversions,scval-conversions,string-conversionsevents/:consume,ingestbytes-conversionsandstring-conversions: Rust moved from first to last.ingest: JavaScript moved before Python.prepareTransaction. Where a page needs one, the Go tab defines a small helper and says so in one line.restore-datadefinesassembleTransactionfor the same reason.restore-contractandrestore-datareuse the GosubmitTxfromsubmit-transaction-wait(Add Go examples to the transactions and basics guides #3123).A choice to confirm
gorm.io/driver/sqlite, the Go match for Prisma and SQLAlchemy. That driver needs cgo. Tell me if you preferdatabase/sqlinstead.storeEventsskips events already stored (OnConflict{DoNothing: true}). Each run starts again at the latest ingested ledger, so that ledger's events come back.Skipped
dapps/state-archival: browser code only, as agreed in Standardize on the languages of the examples throughout the Guides section #1770.BytesN to Fixed-Size Array, the contract TTL code) and the CLI tab.Why this matters
Go readers had no example on these 14 pages. @ElliotFriend chose all four languages on every page in #1770.
Sweep
Not a claim fix, so no sweep. I checked the prose next to each new tab for text that named only JavaScript or Python, and updated it.
Verified
clients/rpcclient/main.go,protocols/rpc/{get_events,get_ledger_entries,simulate_transaction,send_transaction,get_transaction,get_fee_stats,get_health}.go,txnbuild/{transaction,extend_footprint_ttl,restore_footprint,invoke_host_function,asset}.go,xdr/{xdr_generated,ledger_key,scval,account_id}.go,strkey/main.go. The pages pin no Go SDK version.txnbuild.NewTransactionaddsSorobanData.ResourceFeeto the fee (transaction.go:902-926). Sorestore-datadoes not addminResourceFeeby hand, unlike the JavaScript tab.xdr.ScVal.String()prints a symbol as its text, an address as its strkey and ani32as a number (scval.go:249-327). That gives the listener output onconsume.SegmentFilter.UnmarshalJSONtakes*or a base64 ScVal (get_events.go:386-404), soingestdecodes the topic filter from the same JSON as the other tabs.AfterCreate(*gorm.DB) errorhook (callbacks/interfaces.go:9),clause.OnConflict.DoNothing,logger.LogMode.gorm.io/driver/sqlitev1.6.0 importsmattn/go-sqlite3(cgo).pnpm checkpasses: prettier,mint validate, no broken links.Not verified
goneeds approval in this lane. A maintainer runs the Go blocks before merge, as @ElliotFriend said on Add Go examples to the transactions and basics guides #3123.main(stacked PR).Overlaps
consume,ingestand the archival pages (🎨 Clean up images, imports #2231, 📝 Refresh six classic guides #723). Neither adds Go.Found in passing, not fixed here
Defects in existing code on these pages. #3119 collects such defects, but it carries
bot:hands-off, so I did not post there. A maintainer can move these to it.conversions/bytes-conversions.mdxL23 and L26 (JavaScript):const addressFromBytesis declared twice in one block, aSyntaxError.events/ingest.mdx(JavaScript):latestEventIngestedisnullon an empty database, so.ledgerthrows.forEach(async ...)does not wait for the writes.event.contractId!is TypeScript syntax in ajavascriptblock.events/ingest.mdxL238 (Python): usescontract_idbefore L251 defines it.